1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

math.bits: fix bits.div_64 behaviour for leading_zeros_64(y) = 0

This commit is contained in:
Delyan Angelov
2022-01-16 18:04:51 +02:00
parent 315b2deda9
commit 2a3a4cfc84
2 changed files with 36 additions and 6 deletions

View File

@@ -286,3 +286,12 @@ fn test_bits() {
assert rem == rem_64(hi, lo, y)
}
}
fn test_div_64_edge_cases() {
qq, rr := div_64(10, 12, 11)
assert qq == 16769767339735956015
assert rr == 7
q, r := div_64(0, 23, 10000000000000000000)
assert q == 0
assert r == 23
}