mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-03 10:24:44 +00:00
Fix compile time errors when using tables on 8/16-bits systems. (#23450)
Refer to the discussion in #23439.
This commit is contained in:
@@ -58,7 +58,10 @@ proc rawGetKnownHC[X, A](t: X, key: A, hc: Hash): int {.inline.} =
|
||||
template genHashImpl(key, hc: typed) =
|
||||
hc = hash(key)
|
||||
if hc == 0: # This almost never taken branch should be very predictable.
|
||||
hc = 314159265 # Value doesn't matter; Any non-zero favorite is fine.
|
||||
when sizeof(int) < 4:
|
||||
hc = 31415 # Value doesn't matter; Any non-zero favorite is fine <= 16-bit.
|
||||
else:
|
||||
hc = 314159265 # Value doesn't matter; Any non-zero favorite is fine.
|
||||
|
||||
template genHash(key: typed): Hash =
|
||||
var res: Hash
|
||||
|
||||
Reference in New Issue
Block a user