mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 16:52:18 +01:00
Remove the writer1.length method.
This commit is contained in:
1 parent
5052b16f2d
commit
c0c023e1cf
3 files changed
+22
-24
No files matched your search
@@ -244,21 +244,11 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
|||||||
if pp == parenthesesMandatory {
|
if pp == parenthesesMandatory {
|
||||||
b.writeb('(')
|
b.writeb('(')
|
||||||
}
|
}
|
||||||
|
b.writes("(uint64_t)(")
|
||||||
x := n.LHS().Expr().LHS().Expr()
|
if err := g.writeExpr(b, n.LHS().Expr().LHS().Expr(), rp, parenthesesMandatory, depth); err != nil {
|
||||||
if typ := x.MType(); typ.Decorator() == 0 && typ.Name().Key() == t.KeyWriter1 {
|
return err
|
||||||
// TODO: don't hard-code dst.
|
|
||||||
const wName = "dst"
|
|
||||||
b.printf("(uint64_t)(%s%s.private_impl.mark ? (%swptr_%s - %s%s.private_impl.mark) : 0)",
|
|
||||||
aPrefix, wName, bPrefix, wName, aPrefix, wName)
|
|
||||||
} else {
|
|
||||||
b.writes("(uint64_t)(")
|
|
||||||
if err := g.writeExpr(b, x, rp, parenthesesMandatory, depth); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
b.writes(".len)")
|
|
||||||
}
|
}
|
||||||
|
b.writes(".len)")
|
||||||
if pp == parenthesesMandatory {
|
if pp == parenthesesMandatory {
|
||||||
b.writeb(')')
|
b.writeb(')')
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-8
@@ -1557,15 +1557,23 @@ puffs_flate__status puffs_flate__flate_decoder__decode_huffman(
|
|||||||
v_n_copied = 0;
|
v_n_copied = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (((uint64_t)(v_distance)) >
|
if (((uint64_t)(v_distance)) >
|
||||||
((uint64_t)(a_dst.private_impl.mark
|
((uint64_t)(((puffs_base__slice_u8){
|
||||||
? (b_wptr_dst - a_dst.private_impl.mark)
|
.ptr = a_dst.private_impl.mark,
|
||||||
: 0))) {
|
.len = a_dst.private_impl.mark
|
||||||
|
? b_wptr_dst - a_dst.private_impl.mark
|
||||||
|
: 0,
|
||||||
|
})
|
||||||
|
.len))) {
|
||||||
v_hlen = 0;
|
v_hlen = 0;
|
||||||
v_hdist = ((uint32_t)(
|
v_hdist = ((uint32_t)((
|
||||||
(((uint64_t)(v_distance)) -
|
((uint64_t)(v_distance)) -
|
||||||
((uint64_t)(a_dst.private_impl.mark
|
((uint64_t)(((puffs_base__slice_u8){
|
||||||
? (b_wptr_dst - a_dst.private_impl.mark)
|
.ptr = a_dst.private_impl.mark,
|
||||||
: 0)))));
|
.len = a_dst.private_impl.mark
|
||||||
|
? b_wptr_dst - a_dst.private_impl.mark
|
||||||
|
: 0,
|
||||||
|
})
|
||||||
|
.len)))));
|
||||||
if (v_length > v_hdist) {
|
if (v_length > v_hdist) {
|
||||||
v_length -= v_hdist;
|
v_length -= v_hdist;
|
||||||
v_hlen = v_hdist;
|
v_hlen = v_hdist;
|
||||||
|
|||||||
@@ -376,12 +376,12 @@ pri func flate_decoder.decode_huffman?(dst writer1, src reader1)() {
|
|||||||
var n_copied u32
|
var n_copied u32
|
||||||
while true {
|
while true {
|
||||||
// Copy from this.history.
|
// Copy from this.history.
|
||||||
if (distance as u64) > in.dst.length() {
|
if (distance as u64) > in.dst.since_mark().length() {
|
||||||
// Set (hlen, hdist) to be the length-distance pair to copy
|
// Set (hlen, hdist) to be the length-distance pair to copy
|
||||||
// from this.history, and (length, distance) to be the
|
// from this.history, and (length, distance) to be the
|
||||||
// remaining length-distance pair to copy from in.dst.
|
// remaining length-distance pair to copy from in.dst.
|
||||||
var hlen u32[..0x7FFF]
|
var hlen u32[..0x7FFF]
|
||||||
var hdist u32[..0x7FFF] = ((distance as u64) - in.dst.length()) as u32
|
var hdist u32[..0x7FFF] = ((distance as u64) - in.dst.since_mark().length()) as u32
|
||||||
if length > hdist {
|
if length > hdist {
|
||||||
length -= hdist
|
length -= hdist
|
||||||
hlen = hdist
|
hlen = hdist
|
||||||
|
|||||||
Reference in new issue
Block a user