diff --git a/cmd/tools/vtest-fixed.v b/cmd/tools/vtest-fixed.v index 6c7db0d7e9..d62a886165 100644 --- a/cmd/tools/vtest-fixed.v +++ b/cmd/tools/vtest-fixed.v @@ -19,7 +19,6 @@ const ( 'vlib/flag/flag_test.v', 'vlib/json/json_test.v', 'vlib/math/big/big_test.v', - 'vlib/math/bits/bits_test.v', 'vlib/math/complex/complex_test.v', 'vlib/math/factorial/factorial_test.v', 'vlib/math/fractions/fraction_test.v', diff --git a/vlib/math/bits/bits.v b/vlib/math/bits/bits.v index 66d89b30dc..e8eaf40149 100644 --- a/vlib/math/bits/bits.v +++ b/vlib/math/bits/bits.v @@ -477,7 +477,7 @@ pub fn div_64(hi u64, lo u64, y1 u64) (u64, u64) { // for y == 0 (division by zero) but, unlike Div32, it doesn't panic // on a quotient overflow. pub fn rem_32(hi u32, lo u32, y u32) u32 { - return u32((u64(hi)<<32 | u64(lo)) % u64(y)) + return u32(((u64(hi)<<32) | u64(lo)) % u64(y)) } // rem_64 returns the remainder of (hi, lo) divided by y. Rem64 panics diff --git a/vlib/math/bits/bits_test.v b/vlib/math/bits/bits_test.v index 9b74d9d9f7..dfd35f1d0c 100644 --- a/vlib/math/bits/bits_test.v +++ b/vlib/math/bits/bits_test.v @@ -236,11 +236,10 @@ fn test_bits(){ // 32 bit i = 1 for x in 0..32 { - v0 := (u32(i) << x) + v0 := u32(i) << x v1 := v0 - 1 hi, lo := mul_32(v0, v1) - //C.printf("x:%08x [%llu,%llu] %llu\n", v0, hi, lo, u64(v0 * v1)) - assert (u64(hi) << 32) | (u64(lo)) == u64(v0 * v1) + assert (u64(hi) << 32) | (u64(lo)) == u64(v0) * u64(v1) } // 64 bit