builtin: fix string.hash method for `gcc -O2` (#5794)

pull/5797/head
Uwe Krüger 2020-07-11 00:18:52 +02:00 committed by GitHub
parent 7248d8422e
commit 646df49c74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1326,13 +1326,13 @@ pub fn (c byte) is_white() bool {
pub fn (s string) hash() int {
// mut h := s.hash_cache
mut h := 0
mut h := u32(0)
if h == 0 && s.len > 0 {
for c in s {
h = h * 31 + int(c)
h = h * 31 + u32(c)
}
}
return h
return int(h)
}
pub fn (s string) bytes() []byte {