Remove unnecessary iox_etc nullptr checks
diff --git a/internal/cgen/builtin.go b/internal/cgen/builtin.go
index 4231c52..1529d6b 100644
--- a/internal/cgen/builtin.go
+++ b/internal/cgen/builtin.go
@@ -141,16 +141,15 @@
return nil
case t.IDCountSince:
- b.printf("(%s%s ? wuffs_base__io__count_since(", prefix, name)
+ b.printf("wuffs_base__io__count_since(")
if err := g.writeExpr(b, args[0].AsArg().Value(), depth); err != nil {
return err
}
- b.printf(", ((uint64_t)(%s%s%s - %s%s%s))) : 0)", iopPrefix, prefix, name, io0Prefix, prefix, name)
+ b.printf(", ((uint64_t)(%s%s%s - %s%s%s)))", iopPrefix, prefix, name, io0Prefix, prefix, name)
return nil
case t.IDMark:
- b.printf("(%s%s ? ((uint64_t)(%s%s%s - %s%s%s)) : 0)",
- prefix, name, iopPrefix, prefix, name, io0Prefix, prefix, name)
+ b.printf("((uint64_t)(%s%s%s - %s%s%s))", iopPrefix, prefix, name, io0Prefix, prefix, name)
return nil
case t.IDPosition:
@@ -159,13 +158,12 @@
return nil
case t.IDSince:
- b.printf("(%s%s ? wuffs_base__io__since(", prefix, name)
+ b.printf("wuffs_base__io__since(")
if err := g.writeExpr(b, args[0].AsArg().Value(), depth); err != nil {
return err
}
- b.printf(", ((uint64_t)(iop_%s%s - %s%s)), %s%s)"+
- ": wuffs_base__make_slice_u8(NULL, 0))",
- prefix, name, io0Prefix, name, io0Prefix, name)
+ b.printf(", ((uint64_t)(%s%s%s - %s%s%s)), %s%s%s)",
+ iopPrefix, prefix, name, io0Prefix, prefix, name, io0Prefix, prefix, name)
return nil
case t.IDSkipFast:
@@ -246,11 +244,11 @@
return g.writeArgs(b, args, depth)
case t.IDCountSince:
- b.printf("(a_dst ? wuffs_base__io__count_since(")
+ b.printf("wuffs_base__io__count_since(")
if err := g.writeExpr(b, args[0].AsArg().Value(), depth); err != nil {
return err
}
- b.printf(", ((uint64_t)(iop_a_dst - io0_a_dst))) : 0)")
+ b.printf(", ((uint64_t)(iop_a_dst - io0_a_dst)))")
return nil
case t.IDHistoryAvailable:
@@ -258,7 +256,7 @@
return nil
case t.IDMark:
- b.printf("(a_dst ? ((uint64_t)(iop_a_dst - io0_a_dst)) : 0)")
+ b.printf("((uint64_t)(iop_a_dst - io0_a_dst))")
return nil
case t.IDPosition:
@@ -266,12 +264,11 @@
return nil
case t.IDSince:
- b.printf("(a_dst ? wuffs_base__io__since(")
+ b.printf("wuffs_base__io__since(")
if err := g.writeExpr(b, args[0].AsArg().Value(), depth); err != nil {
return err
}
- b.printf(", ((uint64_t)(iop_a_dst - io0_a_dst)), io0_a_dst)" +
- ": wuffs_base__make_slice_u8(NULL, 0))")
+ b.printf(", ((uint64_t)(iop_a_dst - io0_a_dst)), io0_a_dst)")
return nil
}
diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c
index 7017b24..bd309d3 100644
--- a/release/c/wuffs-unsupported-snapshot.c
+++ b/release/c/wuffs-unsupported-snapshot.c
@@ -6424,7 +6424,7 @@
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
while (true) {
- v_mark = (a_dst ? ((uint64_t)(iop_a_dst - io0_a_dst)) : 0);
+ v_mark = ((uint64_t)(iop_a_dst - io0_a_dst));
{
if (a_dst) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
@@ -6446,10 +6446,8 @@
}
goto ok;
}
- v_written =
- (a_dst ? wuffs_base__io__since(
- v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)), io0_a_dst)
- : wuffs_base__make_slice_u8(NULL, 0));
+ v_written = wuffs_base__io__since(
+ v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)), io0_a_dst);
if (((uint64_t)(v_written.len)) >= 32768) {
v_written = wuffs_base__slice_u8__suffix(v_written, 32768);
wuffs_base__slice_u8__copy_from_slice(
@@ -10905,7 +10903,7 @@
4096),
self->private_impl.f_compressed_ri,
self->private_impl.f_compressed_wi));
- v_mark = (v_r ? ((uint64_t)(iop_v_r - io0_v_r)) : 0);
+ v_mark = ((uint64_t)(iop_v_r - io0_v_r));
{
u_r.meta.ri = ((size_t)(iop_v_r - u_r.data.ptr));
wuffs_base__status t_1 = wuffs_lzw__decoder__decode_io_writer(
@@ -10917,9 +10915,8 @@
}
wuffs_base__u64__sat_add_indirect(
&self->private_impl.f_compressed_ri,
- (v_r ? wuffs_base__io__count_since(
- v_mark, ((uint64_t)(iop_v_r - io0_v_r)))
- : 0));
+ wuffs_base__io__count_since(v_mark,
+ ((uint64_t)(iop_v_r - io0_v_r))));
v_r = o_0_v_r;
iop_v_r = o_0_iop_v_r;
io0_v_r = o_0_io0_v_r;
@@ -11479,7 +11476,7 @@
goto exit;
}
while (true) {
- v_mark = (a_dst ? ((uint64_t)(iop_a_dst - io0_a_dst)) : 0);
+ v_mark = ((uint64_t)(iop_a_dst - io0_a_dst));
{
if (a_dst) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
@@ -11500,14 +11497,12 @@
if (!self->private_impl.f_ignore_checksum) {
v_checksum_got = wuffs_crc32__ieee_hasher__update(
&self->private_data.f_checksum,
- (a_dst ? wuffs_base__io__since(
- v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)), io0_a_dst)
- : wuffs_base__make_slice_u8(NULL, 0)));
- v_decoded_length_got += ((uint32_t)(
- ((a_dst ? wuffs_base__io__count_since(
- v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)))
- : 0) &
- 4294967295)));
+ wuffs_base__io__since(v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)),
+ io0_a_dst));
+ v_decoded_length_got +=
+ ((uint32_t)((wuffs_base__io__count_since(
+ v_mark, ((uint64_t)(iop_a_dst - io0_a_dst))) &
+ 4294967295)));
}
if (wuffs_base__status__is_ok(v_status)) {
goto label_2_break;
@@ -11842,7 +11837,7 @@
goto exit;
}
while (true) {
- v_mark = (a_dst ? ((uint64_t)(iop_a_dst - io0_a_dst)) : 0);
+ v_mark = ((uint64_t)(iop_a_dst - io0_a_dst));
{
if (a_dst) {
a_dst->meta.wi = ((size_t)(iop_a_dst - a_dst->data.ptr));
@@ -11863,9 +11858,8 @@
if (!self->private_impl.f_ignore_checksum) {
v_checksum_got = wuffs_adler32__hasher__update(
&self->private_data.f_checksum,
- (a_dst ? wuffs_base__io__since(
- v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)), io0_a_dst)
- : wuffs_base__make_slice_u8(NULL, 0)));
+ wuffs_base__io__since(v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)),
+ io0_a_dst));
}
if (wuffs_base__status__is_ok(v_status)) {
goto label_0_break;