Rename "!=" to "<>"; "!" now only shows impurity

This commit is contained in:
Nigel Tao committed 2019-03-02 14:51:32 +11:00
1 parent f8d02cfb16
commit ef7aa0d980
11 files changed
+82 -83

No files matched your search

+13 -13
View File
@@ -34,7 +34,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
var hlen base.u32[..0x7FFF]
var hdist base.u32
if (this.n_bits >= 8) or ((this.bits >> (this.n_bits & 7)) != 0) {
if (this.n_bits >= 8) or ((this.bits >> (this.n_bits & 7)) <> 0) {
return "#internal error: inconsistent n_bits"
}
@@ -97,18 +97,18 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
bits >>= table_entry_n_bits
n_bits -= table_entry_n_bits
if (table_entry >> 31) != 0 {
if (table_entry >> 31) <> 0 {
// Literal.
args.dst.write_fast_u8!(x:((table_entry >> 8) & 0xFF) as base.u8)
continue:loop
} else if (table_entry >> 30) != 0 {
} else if (table_entry >> 30) <> 0 {
// No-op; code continues past the if-else chain.
assert args.src.available() >= 8
} else if (table_entry >> 29) != 0 {
} else if (table_entry >> 29) <> 0 {
// End of block.
this.end_of_block = true
break:loop
} else if (table_entry >> 28) != 0 {
} else if (table_entry >> 28) <> 0 {
// Redirect.
// Ensure that we have at least 15 bits of input.
@@ -139,19 +139,19 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
bits >>= table_entry_n_bits
n_bits -= table_entry_n_bits
if (table_entry >> 31) != 0 {
if (table_entry >> 31) <> 0 {
// Literal.
args.dst.write_fast_u8!(x:((table_entry >> 8) & 0xFF) as base.u8)
continue:loop
} else if (table_entry >> 30) != 0 {
} else if (table_entry >> 30) <> 0 {
// No-op; code continues past the if-else chain.
} else if (table_entry >> 29) != 0 {
} else if (table_entry >> 29) <> 0 {
// End of block.
this.end_of_block = true
break:loop
} else if (table_entry >> 28) != 0 {
} else if (table_entry >> 28) <> 0 {
return "#internal error: inconsistent Huffman decoder state"
} else if (table_entry >> 27) != 0 {
} else if (table_entry >> 27) <> 0 {
return "#bad Huffman code"
} else {
return "#internal error: inconsistent Huffman decoder state"
@@ -160,7 +160,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
// Once again, redundant but explicit assertions.
assert args.src.available() >= 8
} else if (table_entry >> 27) != 0 {
} else if (table_entry >> 27) <> 0 {
return "#bad Huffman code"
} else {
return "#internal error: inconsistent Huffman decoder state"
@@ -257,7 +257,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
}
// For H-D, all symbols should be base_number + extra_bits.
if (table_entry >> 24) != 0x40 {
if (table_entry >> 24) <> 0x40 {
if (table_entry >> 24) == 0x08 {
return "#bad Huffman code"
}
@@ -396,7 +396,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
this.bits = bits & (((1 as base.u32) << n_bits) - 1)
this.n_bits = n_bits
if (this.n_bits >= 8) or ((this.bits >> this.n_bits) != 0) {
if (this.n_bits >= 8) or ((this.bits >> this.n_bits) <> 0) {
return "#internal error: inconsistent n_bits"
}
}