From 646df49c74d662d0e3f282a255da6da644d796d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kr=C3=BCger?= <45282134+UweKrueger@users.noreply.github.com> Date: Sat, 11 Jul 2020 00:18:52 +0200 Subject: [PATCH] builtin: fix string.hash method for `gcc -O2` (#5794) --- vlib/builtin/string.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 83f9f87357..a3f089ab4b 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -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 {