fixes #5969
This commit is contained in:
parent
280941aca6
commit
72115c2b09
1 changed files with 8 additions and 3 deletions
|
|
@ -139,9 +139,14 @@ proc hash*(x: cstring): Hash =
|
||||||
## efficient hashing of null-terminated strings
|
## efficient hashing of null-terminated strings
|
||||||
var h: Hash = 0
|
var h: Hash = 0
|
||||||
var i = 0
|
var i = 0
|
||||||
while x[i] != 0.char:
|
when defined(js):
|
||||||
h = h !& ord(x[i])
|
while i < x.len:
|
||||||
inc i
|
h = h !& ord(x[i])
|
||||||
|
inc i
|
||||||
|
else:
|
||||||
|
while x[i] != 0.char:
|
||||||
|
h = h !& ord(x[i])
|
||||||
|
inc i
|
||||||
result = !$h
|
result = !$h
|
||||||
|
|
||||||
proc hash*(sBuf: string, sPos, ePos: int): Hash =
|
proc hash*(sBuf: string, sPos, ePos: int): Hash =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue