Skip to content

Commit 646df49

Browse files
authored
builtin: fix string.hash method for gcc -O2 (#5794)
1 parent 7248d84 commit 646df49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vlib/builtin/string.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,13 +1326,13 @@ pub fn (c byte) is_white() bool {
13261326

13271327
pub fn (s string) hash() int {
13281328
// mut h := s.hash_cache
1329-
mut h := 0
1329+
mut h := u32(0)
13301330
if h == 0 && s.len > 0 {
13311331
for c in s {
1332-
h = h * 31 + int(c)
1332+
h = h * 31 + u32(c)
13331333
}
13341334
}
1335-
return h
1335+
return int(h)
13361336
}
13371337

13381338
pub fn (s string) bytes() []byte {

0 commit comments

Comments
 (0)