Propagate tighter bounds checks after assignments

This commit is contained in:
Nigel Tao committed 2018-12-26 16:52:55 +11:00
1 parent 231389ee26
commit 7405307173
4 files changed
+72 -36

No files matched your search

+6 -1
View File
@@ -138,7 +138,12 @@ pri func decoder.read_from!(src base.io_reader) {
bits |= args.src.peek_u8_as_u32() << n_bits
args.src.skip_fast!(actual:1, worst_case:1)
n_bits += 8
if n_bits < width { // TODO: should be unnecessary: n_bits >= 16 > width.
assert width <= n_bits via "a <= b: a <= c; c <= b"(c:12)
assert n_bits >= width via "a >= b: b <= a"()
// This if condition is always false, but for some unknown
// reason, removing it worsens the benchmarks slightly.
if n_bits < width {
this.read_from_return_value = 4
break
}