diff options
-rw-r--r-- | lib/pure/base64.nim | 9 | ||||
-rw-r--r-- | lib/pure/hashes.nim | 8 | ||||
-rw-r--r-- | lib/pure/md5.nim | 3 | ||||
-rw-r--r-- | lib/pure/mersenne.nim | 3 | ||||
-rw-r--r-- | lib/pure/oids.nim | 5 |
5 files changed, 16 insertions, 12 deletions
diff --git a/lib/pure/base64.nim b/lib/pure/base64.nim index a8c490d4d..a5b69fadb 100644 --- a/lib/pure/base64.nim +++ b/lib/pure/base64.nim @@ -112,7 +112,8 @@ template encodeInternal(s: typed, lineLen: int, newLine: string): untyped = #assert(r == result.len) discard -proc encode*[T: SomeInteger|char](s: openArray[T], lineLen = 75, newLine=""): string = +proc encode*[T: SomeInteger|char](s: openArray[T], lineLen = 75, + newLine = ""): string = ## Encodes ``s`` into base64 representation. After ``lineLen`` characters, a ## ``newline`` is added. ## @@ -128,7 +129,7 @@ proc encode*[T: SomeInteger|char](s: openArray[T], lineLen = 75, newLine=""): st assert encode([1, 2, 3, 4, 5]) == "AQIDBAU=" encodeInternal(s, lineLen, newLine) -proc encode*(s: string, lineLen = 75, newLine=""): string = +proc encode*(s: string, lineLen = 75, newLine = ""): string = ## Encodes ``s`` into base64 representation. After ``lineLen`` characters, a ## ``newline`` is added. ## @@ -208,5 +209,5 @@ when isMainModule: for t in items(tests): assert decode(encode(t)) == t - assert decode(encode(t, lineLen=40)) == t - assert decode(encode(t, lineLen=76)) == t + assert decode(encode(t, lineLen = 40)) == t + assert decode(encode(t, lineLen = 76)) == t diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim index c1338376e..cb0250dbd 100644 --- a/lib/pure/hashes.nim +++ b/lib/pure/hashes.nim @@ -45,7 +45,7 @@ ## * `tables module <tables.html>`_ for hash tables type - Hash* = int ## A hash value. Hash tables using these values should + Hash* = int ## A hash value. Hash tables using these values should ## always have a size of a power of two and can use the ``and`` ## operator instead of ``mod`` for truncation of the hash value. @@ -451,7 +451,7 @@ when isMainModule: doAssert hashIgnoreStyle("aa_bb_AAaa1234") == hashIgnoreCase("aaBBAAAa1234") block smallSize: # no multibyte hashing let - xx = @['H','i'] + xx = @['H', 'i'] ii = @[72'u8, 105] ss = "Hi" doAssert hash(xx) == hash(ii) @@ -460,8 +460,8 @@ when isMainModule: doAssert hash(ss) == hash(ss, 0, ss.high) block largeSize: # longer than 4 characters let - xx = @['H','e','l','l','o'] - xxl = @['H','e','l','l','o','w','e','e','n','s'] + xx = @['H', 'e', 'l', 'l', 'o'] + xxl = @['H', 'e', 'l', 'l', 'o', 'w', 'e', 'e', 'n', 's'] ssl = "Helloweens" doAssert hash(xxl) == hash(ssl) doAssert hash(xxl) == hash(xxl, 0, xxl.high) diff --git a/lib/pure/md5.nim b/lib/pure/md5.nim index b6f814b88..1ea71afd2 100644 --- a/lib/pure/md5.nim +++ b/lib/pure/md5.nim @@ -172,7 +172,8 @@ proc transform(buffer: pointer, state: var MD5State) = state[3] = state[3] + d proc md5Init*(c: var MD5Context) {.raises: [], tags: [], gcsafe.} -proc md5Update*(c: var MD5Context, input: cstring, len: int) {.raises: [], tags: [], gcsafe.} +proc md5Update*(c: var MD5Context, input: cstring, len: int) {.raises: [], + tags: [], gcsafe.} proc md5Final*(c: var MD5Context, digest: var MD5Digest) {.raises: [], tags: [], gcsafe.} diff --git a/lib/pure/mersenne.nim b/lib/pure/mersenne.nim index b2227f114..a2b8914d9 100644 --- a/lib/pure/mersenne.nim +++ b/lib/pure/mersenne.nim @@ -16,7 +16,8 @@ proc newMersenneTwister*(seed: uint32): MersenneTwister = result.index = 0 result.mt[0] = seed for i in 1'u32 .. 623'u32: - result.mt[i] = (0x6c078965'u32 * (result.mt[i-1] xor (result.mt[i-1] shr 30'u32)) + i) + result.mt[i] = (0x6c078965'u32 * (result.mt[i-1] xor + (result.mt[i-1] shr 30'u32)) + i) proc generateNumbers(m: var MersenneTwister) = for i in 0..623: diff --git a/lib/pure/oids.nim b/lib/pure/oids.nim index f3f50c25d..d3a7c4fb6 100644 --- a/lib/pure/oids.nim +++ b/lib/pure/oids.nim @@ -18,14 +18,15 @@ import hashes, times, endians type - Oid* = object ## an OID + Oid* = object ## an OID time: int32 ## fuzz: int32 ## count: int32 ## proc `==`*(oid1: Oid, oid2: Oid): bool = ## Compare two Mongo Object IDs for equality - return (oid1.time == oid2.time) and (oid1.fuzz == oid2.fuzz) and (oid1.count == oid2.count) + return (oid1.time == oid2.time) and (oid1.fuzz == oid2.fuzz) and + (oid1.count == oid2.count) proc hash*(oid: Oid): Hash = ## Generate hash of Oid for use in hashtables |