mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-12 10:33:07 +00:00
support nim 2.0
This commit is contained in:
parent
92b8ea028a
commit
64cc99442d
@ -49,6 +49,22 @@ proc setMethodHandler(
|
||||
) =
|
||||
subscriptions.methodHandlers[`method`] = handler
|
||||
|
||||
when (NimMajor) >= 2:
|
||||
proc hash*[A](x: openArray[A]): Hash {.raises: [].} =
|
||||
## Efficient hashing of arrays and sequences.
|
||||
## There must be a `hash` proc defined for the element type `A`.
|
||||
when A is byte:
|
||||
result = murmurHash(x)
|
||||
elif A is char:
|
||||
when nimvm:
|
||||
result = hashVmImplChar(x, 0, x.high)
|
||||
else:
|
||||
result = murmurHash(toOpenArrayByte(x, 0, x.high))
|
||||
else:
|
||||
for a in x:
|
||||
result = result !& hash(a)
|
||||
result = !$result
|
||||
|
||||
func hash*(n: OrderedTable[string, JsonNode]): Hash {.raises: [].}
|
||||
|
||||
proc hash*(n: JsonNode): Hash {.noSideEffect, raises: [].} =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user