std: rename some CLAMP and CLIP tables

This commit is contained in:
Nigel Tao committed 2026-06-14 20:12:21 +10:00
1 parent 5daeafbc6f
commit 18488a3bd0
6 files changed
+16 -14

No files matched your search

+4 -2
View File
@@ -23,7 +23,9 @@ pri status "#internal error: inconsistent Huffman decoder state"
pub const DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
pri const CLAMP_TO_5 : roarray[8] base.u8[..= 5] = [0, 1, 2, 3, 4, 5, 5, 5]
pri const CLAMP_NO_MORE_THAN_5 : roarray[8] base.u8[..= 5] = [
0, 1, 2, 3, 4, 5, 5, 5,
]
pub struct decoder? implements base.io_transformer(
bits : base.u32,
@@ -197,7 +199,7 @@ pri func decoder.do_transform_io?(dst: base.io_writer, src: base.io_reader, work
this.block_size = 0
this.decode_huffman_finished = false
this.decode_huffman_which = CLAMP_TO_5[this.huffman_selectors[0] & 7]
this.decode_huffman_which = CLAMP_NO_MORE_THAN_5[this.huffman_selectors[0] & 7]
this.decode_huffman_ticks = 50
this.decode_huffman_section = 0
this.decode_huffman_run_shift = 0
+1 -1
View File
@@ -44,7 +44,7 @@ pri func decoder.decode_huffman_fast!(src: base.io_reader) base.status {
if section >= this.num_sections {
return "#bad number of sections"
}
which = CLAMP_TO_5[this.huffman_selectors[section & 32767] & 7]
which = CLAMP_NO_MORE_THAN_5[this.huffman_selectors[section & 32767] & 7]
}
bits |= args.src.peek_u32be() >> n_bits
+1 -1
View File
@@ -30,7 +30,7 @@ pri func decoder.decode_huffman_slow?(src: base.io_reader) {
if this.decode_huffman_section >= this.num_sections {
return "#bad number of sections"
}
this.decode_huffman_which = CLAMP_TO_5[this.huffman_selectors[this.decode_huffman_section & 32767] & 7]
this.decode_huffman_which = CLAMP_NO_MORE_THAN_5[this.huffman_selectors[this.decode_huffman_section & 32767] & 7]
}
node_index = 0