Check that extra-field types aren't refined

This commit is contained in:
Nigel Tao committed 2019-02-16 15:40:02 +11:00
1 parent 21eb64f4c6
commit 92959fb81f
6 files changed
+63 -37

No files matched your search

+5 -5
View File
@@ -57,10 +57,10 @@ pub struct decoder?(
)(
// read_from per-code state.
suffixes array[4096] array[8] base.u8,
prefixes array[4096] base.u16[..4095],
prefixes array[4096] base.u16,
// lm1s is the "length minus 1"s of the values for the implicit key-value
// table in this decoder. See std/lzw/README.md for more detail.
lm1s array[4096] base.u16[..4095],
lm1s array[4096] base.u16,
// output[output_ri:output_wi] is the buffered output, connecting read_from
// with write_to and flush.
@@ -199,7 +199,7 @@ pri func decoder.read_from!(src base.io_reader) {
this.output[output_wi] = code as base.u8
output_wi = (output_wi + 1) & 8191
if save_code <= 4095 {
lm1_a = (this.lm1s[prev_code] + 1) & 4095
lm1_a = (this.lm1s[prev_code] ~mod+ 1) & 4095
this.lm1s[save_code] = lm1_a
if (lm1_a % 8) != 0 {
@@ -262,7 +262,7 @@ pri func decoder.read_from!(src base.io_reader) {
// This line is essentially "o -= 8". The "& 8191" is a no-op
// in practice, but is necessary for the overflow checker.
o = (o ~mod- 8) & 8191
c = this.prefixes[c] as base.u32
c = (this.prefixes[c] as base.u32) & 4095
}
first_byte = this.suffixes[c][0]
@@ -272,7 +272,7 @@ pri func decoder.read_from!(src base.io_reader) {
}
if save_code <= 4095 {
lm1_b = (this.lm1s[prev_code] + 1) & 4095
lm1_b = (this.lm1s[prev_code] ~mod+ 1) & 4095
this.lm1s[save_code] = lm1_b
if (lm1_b % 8) != 0 {