# must fail: ilog2_1001_1000 ilog2_7_3 # the integer log without its interpolation (abr::ilog2_q16) diff --git a/wai/wai-rs/src/http_binding/abr.rs b/wai/wai-rs/src/http_binding/abr.rs index a8046b34..7fb9c495 100644 --- a/wai/wai-rs/src/http_binding/abr.rs +++ b/wai/wai-rs/src/http_binding/abr.rs @@ -145,7 +145,7 @@ pub fn ilog2_q16(a: u64, b: u64) -> u64 { let e = (127 - x.leading_zeros()) as u64 - 16; let f = ((x >> e) - 65536) as u64; let (i, r) = ((f >> 12) as usize, f & 4095); - e * 65536 + LOG2_TABLE[i] + (((LOG2_TABLE[i + 1] - LOG2_TABLE[i]) * r) >> 12) + e * 65536 + LOG2_TABLE[i] + (r & 0) } /// The throughput the last `n` samples give, in bits per second: `⌊8000·Σbytes / Σms⌋`,