mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 16:55:11 +01:00
Rename decode_huffman to decode_huffman_slow.
This commit is contained in:
1 parent
c3420dd138
commit
4810db3994
7 files changed
+44
-42
No files matched your search
@@ -517,8 +517,8 @@ func (g *gen) writeCallSuspendibles(b *buffer, n *a.Expr, depth uint32) error {
|
|||||||
}
|
}
|
||||||
b.writes("if (status) { goto suspend; }\n")
|
b.writes("if (status) { goto suspend; }\n")
|
||||||
|
|
||||||
} else if isThisMethod(g.tm, n, "decode_huffman", 2) {
|
} else if isThisMethod(g.tm, n, "decode_huffman_slow", 2) {
|
||||||
b.printf("status = %s%s__decode_huffman(self, %sdst, %ssrc);\n",
|
b.printf("status = %s%s__decode_huffman_slow(self, %sdst, %ssrc);\n",
|
||||||
g.pkgPrefix, g.currFunk.astFunc.Receiver().String(g.tm), aPrefix, aPrefix)
|
g.pkgPrefix, g.currFunk.astFunc.Receiver().String(g.tm), aPrefix, aPrefix)
|
||||||
if err := g.writeLoadExprDerivedVars(b, n); err != nil {
|
if err := g.writeLoadExprDerivedVars(b, n); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
+34
-33
@@ -247,7 +247,7 @@ typedef struct {
|
|||||||
uint32_t v_n_copied;
|
uint32_t v_n_copied;
|
||||||
uint32_t v_hlen;
|
uint32_t v_hlen;
|
||||||
uint32_t v_hdist;
|
uint32_t v_hdist;
|
||||||
} c_decode_huffman[1];
|
} c_decode_huffman_slow[1];
|
||||||
} private_impl;
|
} private_impl;
|
||||||
} puffs_flate__flate_decoder;
|
} puffs_flate__flate_decoder;
|
||||||
|
|
||||||
@@ -780,7 +780,7 @@ static puffs_flate__status puffs_flate__flate_decoder__init_huff(
|
|||||||
uint32_t a_n_codes1,
|
uint32_t a_n_codes1,
|
||||||
uint32_t a_base_symbol);
|
uint32_t a_base_symbol);
|
||||||
|
|
||||||
static puffs_flate__status puffs_flate__flate_decoder__decode_huffman(
|
static puffs_flate__status puffs_flate__flate_decoder__decode_huffman_slow(
|
||||||
puffs_flate__flate_decoder* self,
|
puffs_flate__flate_decoder* self,
|
||||||
puffs_base__writer1 a_dst,
|
puffs_base__writer1 a_dst,
|
||||||
puffs_base__reader1 a_src);
|
puffs_base__reader1 a_src);
|
||||||
@@ -1101,7 +1101,8 @@ static puffs_flate__status puffs_flate__flate_decoder__decode_blocks(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status = puffs_flate__flate_decoder__decode_huffman(self, a_dst, a_src);
|
status =
|
||||||
|
puffs_flate__flate_decoder__decode_huffman_slow(self, a_dst, a_src);
|
||||||
if (a_src.buf) {
|
if (a_src.buf) {
|
||||||
b_rptr_src = a_src.buf->ptr + a_src.buf->ri;
|
b_rptr_src = a_src.buf->ptr + a_src.buf->ri;
|
||||||
}
|
}
|
||||||
@@ -1903,7 +1904,7 @@ exit:
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static puffs_flate__status puffs_flate__flate_decoder__decode_huffman(
|
static puffs_flate__status puffs_flate__flate_decoder__decode_huffman_slow(
|
||||||
puffs_flate__flate_decoder* self,
|
puffs_flate__flate_decoder* self,
|
||||||
puffs_base__writer1 a_dst,
|
puffs_base__writer1 a_dst,
|
||||||
puffs_base__reader1 a_src) {
|
puffs_base__reader1 a_src) {
|
||||||
@@ -1954,22 +1955,22 @@ static puffs_flate__status puffs_flate__flate_decoder__decode_huffman(
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t coro_susp_point =
|
uint32_t coro_susp_point =
|
||||||
self->private_impl.c_decode_huffman[0].coro_susp_point;
|
self->private_impl.c_decode_huffman_slow[0].coro_susp_point;
|
||||||
if (coro_susp_point) {
|
if (coro_susp_point) {
|
||||||
v_bits = self->private_impl.c_decode_huffman[0].v_bits;
|
v_bits = self->private_impl.c_decode_huffman_slow[0].v_bits;
|
||||||
v_n_bits = self->private_impl.c_decode_huffman[0].v_n_bits;
|
v_n_bits = self->private_impl.c_decode_huffman_slow[0].v_n_bits;
|
||||||
v_table_entry = self->private_impl.c_decode_huffman[0].v_table_entry;
|
v_table_entry = self->private_impl.c_decode_huffman_slow[0].v_table_entry;
|
||||||
v_table_entry_n_bits =
|
v_table_entry_n_bits =
|
||||||
self->private_impl.c_decode_huffman[0].v_table_entry_n_bits;
|
self->private_impl.c_decode_huffman_slow[0].v_table_entry_n_bits;
|
||||||
v_lmask = self->private_impl.c_decode_huffman[0].v_lmask;
|
v_lmask = self->private_impl.c_decode_huffman_slow[0].v_lmask;
|
||||||
v_dmask = self->private_impl.c_decode_huffman[0].v_dmask;
|
v_dmask = self->private_impl.c_decode_huffman_slow[0].v_dmask;
|
||||||
v_redir_top = self->private_impl.c_decode_huffman[0].v_redir_top;
|
v_redir_top = self->private_impl.c_decode_huffman_slow[0].v_redir_top;
|
||||||
v_redir_mask = self->private_impl.c_decode_huffman[0].v_redir_mask;
|
v_redir_mask = self->private_impl.c_decode_huffman_slow[0].v_redir_mask;
|
||||||
v_length = self->private_impl.c_decode_huffman[0].v_length;
|
v_length = self->private_impl.c_decode_huffman_slow[0].v_length;
|
||||||
v_distance = self->private_impl.c_decode_huffman[0].v_distance;
|
v_distance = self->private_impl.c_decode_huffman_slow[0].v_distance;
|
||||||
v_n_copied = self->private_impl.c_decode_huffman[0].v_n_copied;
|
v_n_copied = self->private_impl.c_decode_huffman_slow[0].v_n_copied;
|
||||||
v_hlen = self->private_impl.c_decode_huffman[0].v_hlen;
|
v_hlen = self->private_impl.c_decode_huffman_slow[0].v_hlen;
|
||||||
v_hdist = self->private_impl.c_decode_huffman[0].v_hdist;
|
v_hdist = self->private_impl.c_decode_huffman_slow[0].v_hdist;
|
||||||
}
|
}
|
||||||
switch (coro_susp_point) {
|
switch (coro_susp_point) {
|
||||||
PUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
|
PUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
|
||||||
@@ -2271,27 +2272,27 @@ static puffs_flate__status puffs_flate__flate_decoder__decode_huffman(
|
|||||||
|
|
||||||
goto ok;
|
goto ok;
|
||||||
ok:
|
ok:
|
||||||
self->private_impl.c_decode_huffman[0].coro_susp_point = 0;
|
self->private_impl.c_decode_huffman_slow[0].coro_susp_point = 0;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto suspend;
|
goto suspend;
|
||||||
suspend:
|
suspend:
|
||||||
self->private_impl.c_decode_huffman[0].coro_susp_point = coro_susp_point;
|
self->private_impl.c_decode_huffman_slow[0].coro_susp_point = coro_susp_point;
|
||||||
self->private_impl.c_decode_huffman[0].v_bits = v_bits;
|
self->private_impl.c_decode_huffman_slow[0].v_bits = v_bits;
|
||||||
self->private_impl.c_decode_huffman[0].v_n_bits = v_n_bits;
|
self->private_impl.c_decode_huffman_slow[0].v_n_bits = v_n_bits;
|
||||||
self->private_impl.c_decode_huffman[0].v_table_entry = v_table_entry;
|
self->private_impl.c_decode_huffman_slow[0].v_table_entry = v_table_entry;
|
||||||
self->private_impl.c_decode_huffman[0].v_table_entry_n_bits =
|
self->private_impl.c_decode_huffman_slow[0].v_table_entry_n_bits =
|
||||||
v_table_entry_n_bits;
|
v_table_entry_n_bits;
|
||||||
self->private_impl.c_decode_huffman[0].v_lmask = v_lmask;
|
self->private_impl.c_decode_huffman_slow[0].v_lmask = v_lmask;
|
||||||
self->private_impl.c_decode_huffman[0].v_dmask = v_dmask;
|
self->private_impl.c_decode_huffman_slow[0].v_dmask = v_dmask;
|
||||||
self->private_impl.c_decode_huffman[0].v_redir_top = v_redir_top;
|
self->private_impl.c_decode_huffman_slow[0].v_redir_top = v_redir_top;
|
||||||
self->private_impl.c_decode_huffman[0].v_redir_mask = v_redir_mask;
|
self->private_impl.c_decode_huffman_slow[0].v_redir_mask = v_redir_mask;
|
||||||
self->private_impl.c_decode_huffman[0].v_length = v_length;
|
self->private_impl.c_decode_huffman_slow[0].v_length = v_length;
|
||||||
self->private_impl.c_decode_huffman[0].v_distance = v_distance;
|
self->private_impl.c_decode_huffman_slow[0].v_distance = v_distance;
|
||||||
self->private_impl.c_decode_huffman[0].v_n_copied = v_n_copied;
|
self->private_impl.c_decode_huffman_slow[0].v_n_copied = v_n_copied;
|
||||||
self->private_impl.c_decode_huffman[0].v_hlen = v_hlen;
|
self->private_impl.c_decode_huffman_slow[0].v_hlen = v_hlen;
|
||||||
self->private_impl.c_decode_huffman[0].v_hdist = v_hdist;
|
self->private_impl.c_decode_huffman_slow[0].v_hdist = v_hdist;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (a_dst.buf) {
|
if (a_dst.buf) {
|
||||||
|
|||||||
+1
-1
@@ -247,7 +247,7 @@ typedef struct {
|
|||||||
uint32_t v_n_copied;
|
uint32_t v_n_copied;
|
||||||
uint32_t v_hlen;
|
uint32_t v_hlen;
|
||||||
uint32_t v_hdist;
|
uint32_t v_hdist;
|
||||||
} c_decode_huffman[1];
|
} c_decode_huffman_slow[1];
|
||||||
} private_impl;
|
} private_impl;
|
||||||
} puffs_flate__flate_decoder;
|
} puffs_flate__flate_decoder;
|
||||||
|
|
||||||
|
|||||||
@@ -724,8 +724,8 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
|
|||||||
isInDst(q.tm, n, t.KeyMark, 0) ||
|
isInDst(q.tm, n, t.KeyMark, 0) ||
|
||||||
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
|
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
|
||||||
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
|
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
|
||||||
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_huffman", 2) ||
|
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_blocks", 2) ||
|
||||||
isThisMethod(q.tm, n, "decode_blocks", 2) ||
|
isThisMethod(q.tm, n, "decode_huffman_slow", 2) ||
|
||||||
isThisMethod(q.tm, n, "init_fixed_huffman", 0) || isThisMethod(q.tm, n, "init_dynamic_huffman", 1) ||
|
isThisMethod(q.tm, n, "init_fixed_huffman", 0) || isThisMethod(q.tm, n, "init_dynamic_huffman", 1) ||
|
||||||
isThisMethod(q.tm, n, "init_huff", 4) ||
|
isThisMethod(q.tm, n, "init_huff", 4) ||
|
||||||
isThatMethod(q.tm, n, t.KeyMark, 0) || isThatMethod(q.tm, n, t.KeyLimit, 1) ||
|
isThatMethod(q.tm, n, t.KeyMark, 0) || isThatMethod(q.tm, n, t.KeyLimit, 1) ||
|
||||||
|
|||||||
+2
-2
@@ -418,8 +418,8 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
|
|||||||
isInDst(q.tm, n, t.KeyMark, 0) ||
|
isInDst(q.tm, n, t.KeyMark, 0) ||
|
||||||
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
|
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
|
||||||
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
|
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
|
||||||
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_huffman", 2) ||
|
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_blocks", 2) ||
|
||||||
isThisMethod(q.tm, n, "decode_blocks", 2) ||
|
isThisMethod(q.tm, n, "decode_huffman_slow", 2) ||
|
||||||
isThisMethod(q.tm, n, "init_fixed_huffman", 0) || isThisMethod(q.tm, n, "init_dynamic_huffman", 1) ||
|
isThisMethod(q.tm, n, "init_fixed_huffman", 0) || isThisMethod(q.tm, n, "init_dynamic_huffman", 1) ||
|
||||||
isThisMethod(q.tm, n, "init_huff", 4) ||
|
isThisMethod(q.tm, n, "init_huff", 4) ||
|
||||||
isThatMethod(q.tm, n, t.KeyMark, 0) || isThatMethod(q.tm, n, t.KeyLimit, 1) ||
|
isThatMethod(q.tm, n, t.KeyMark, 0) || isThatMethod(q.tm, n, t.KeyLimit, 1) ||
|
||||||
|
|||||||
@@ -192,7 +192,8 @@ pri func flate_decoder.decode_blocks?(dst writer1, src reader1)() {
|
|||||||
} else {
|
} else {
|
||||||
return error "bad flate block"
|
return error "bad flate block"
|
||||||
}
|
}
|
||||||
this.decode_huffman?(dst:in.dst, src:in.src)
|
|
||||||
|
this.decode_huffman_slow?(dst:in.dst, src:in.src)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
pri func flate_decoder.decode_huffman?(dst writer1, src reader1)() {
|
pri func flate_decoder.decode_huffman_slow?(dst writer1, src reader1)() {
|
||||||
var bits u32 = this.bits
|
var bits u32 = this.bits
|
||||||
var n_bits u32 = this.n_bits
|
var n_bits u32 = this.n_bits
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user