forge
Explore
Log in

Don't you dare go Hollow

Bits2pulses row-window bound becomes a debug_assert (reviewer P3) - statically decidable from the unchanged CACHE_BITS table

Browse files at this commit

70ebc1759a21dbe9480ffa3f4b08a4d5aed462cbAhmet Kaan GümüşParent: e7bf696
  • refactor
    • bits2pulses row-window bound becomes a debug_assert (reviewer P3) - statically decidable from the unchanged CACHE_BITS table
    • the fixed-window copy still panics if the table ever outgrew it
Show full message
refactor(ec-opus): bits2pulses row-window bound becomes a debug_assert (reviewer P3) - statically decidable from the unchanged CACHE_BITS table; the fixed-window copy still panics if the table ever outgrew it
crates/ec-opus/src/celt.rsmodified+3 -1
@@ -2750,7 +2750,9 @@ const CACHE_ROW_MAX: usize = 64;
27502750 pub(crate) fn bits2pulses(band: usize, lm: i32, bits: i32) -> i32 {
27512751 let base = cache_index(band, lm);
27522752 let count = CACHE_BITS[base] as usize;
2753- assert!(
2753+ // Statically decidable from the unchanged CACHE_BITS table (reviewer P3);
2754+ // the copy below still panics if the table ever outgrew the window.
2755+ debug_assert!(
27542756 count < CACHE_ROW_MAX,
27552757 "CACHE_BITS row overflows the fixed window"
27562758 );