Rename while:label to while.label

This commit is contained in:
Nigel Tao committed 2019-10-12 19:04:32 +11:00
1 parent 5d29c7df61
commit 7872a8893b
8 files changed
+27 -26

No files matched your search

+3 -3
View File
@@ -207,7 +207,7 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader) {
var type base.u32
var status base.status
while:outer final == 0 {
while.outer final == 0 {
while this.n_bits < 3,
post this.n_bits >= 3,
{
@@ -247,11 +247,11 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader) {
return status
}
if this.end_of_block {
continue:outer
continue.outer
}
this.decode_huffman_slow?(dst:args.dst, src:args.src)
if this.end_of_block {
continue:outer
continue.outer
}
}
}
+6 -6
View File
@@ -71,7 +71,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
// for each. There are also up to 13 extra bits, or 2 bytes. Thus, each
// code requires up to 2 + 2 + 2 == 6 bytes, and there are two codes (one
// from H-L and one from H-D). Therefore, we check for at least 12 bytes.
while:loop(args.dst.available() >= 258) and (args.src.available() >= 12) {
while.loop(args.dst.available() >= 258) and (args.src.available() >= 12) {
// Ensure that we have at least 15 bits of input.
if n_bits < 15 {
assert n_bits >= 0 // TODO: this shouldn't be necessary.
@@ -100,14 +100,14 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
if (table_entry >> 31) <> 0 {
// Literal.
args.dst.write_fast_u8!(a:((table_entry >> 8) & 0xFF) as base.u8)
continue:loop
continue.loop
} 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 {
// End of block.
this.end_of_block = true
break:loop
break.loop
} else if (table_entry >> 28) <> 0 {
// Redirect.
@@ -138,13 +138,13 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
if (table_entry >> 31) <> 0 {
// Literal.
args.dst.write_fast_u8!(a:((table_entry >> 8) & 0xFF) as base.u8)
continue:loop
continue.loop
} else if (table_entry >> 30) <> 0 {
// No-op; code continues past the if-else chain.
} else if (table_entry >> 29) <> 0 {
// End of block.
this.end_of_block = true
break:loop
break.loop
} else if (table_entry >> 28) <> 0 {
return "#internal error: inconsistent Huffman decoder state"
} else if (table_entry >> 27) <> 0 {
@@ -342,7 +342,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
if length == 0 {
// No need to copy from args.dst.
continue:loop
continue.loop
}
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_available() {
+6 -6
View File
@@ -48,7 +48,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
lmask = ((1 as base.u32) << this.n_huffs_bits[0]) - 1
dmask = ((1 as base.u32) << this.n_huffs_bits[1]) - 1
while:loop not coroutine_resumed {
while.loop not coroutine_resumed {
// Decode an lcode symbol from H-L.
while true {
table_entry = this.huffs[0][bits & lmask]
@@ -67,13 +67,13 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
if (table_entry >> 31) <> 0 {
// Literal.
args.dst.write_u8?(a:((table_entry >> 8) & 0xFF) as base.u8)
continue:loop
continue.loop
} else if (table_entry >> 30) <> 0 {
// No-op; code continues past the if-else chain.
} else if (table_entry >> 29) <> 0 {
// End of block.
this.end_of_block = true
break:loop
break.loop
} else if (table_entry >> 28) <> 0 {
// Redirect.
redir_top = (table_entry >> 8) & 0xFFFF
@@ -95,13 +95,13 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
if (table_entry >> 31) <> 0 {
// Literal.
args.dst.write_u8?(a:((table_entry >> 8) & 0xFF) as base.u8)
continue:loop
continue.loop
} else if (table_entry >> 30) <> 0 {
// No-op; code continues past the if-else chain.
} else if (table_entry >> 29) <> 0 {
// End of block.
this.end_of_block = true
break:loop
break.loop
} else if (table_entry >> 28) <> 0 {
return "#internal error: inconsistent Huffman decoder state"
} else if (table_entry >> 27) <> 0 {
@@ -259,7 +259,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
if length == 0 {
// No need to copy from args.dst.
continue:loop
continue.loop
}
}
+5 -5
View File
@@ -1004,7 +1004,7 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader,
var uncompressed slice base.u8
need_block_size = true
while:outer true {
while.outer true {
if need_block_size {
need_block_size = false
block_size = args.src.read_u8_as_u64?()
@@ -1044,7 +1044,7 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader,
return base."#bad workbuf length"
}
while:inner true {
while.inner true {
if (this.compressed_ri > this.compressed_wi) or (this.compressed_wi > 4096) {
return "#internal error: inconsistent ri/wi"
}
@@ -1072,11 +1072,11 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader,
this.skip_blocks?(src:args.src)
}
break:outer
break.outer
} else if lzw_status == base."$short read" {
continue:outer
continue.outer
} else if lzw_status == base."$short write" {
continue:inner
continue.inner
}
return lzw_status
}