aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvan Haas <evan@lagerdata.com>2021-04-18 20:55:05 -0700
committerVeikka Tuominen <git@vexu.eu>2021-04-20 11:33:01 +0300
commit55e6bd10fe49614cd54eb02dd44c50d0643804c3 (patch)
treecc0113f3e2a6ed7cb84fb52ae10152e906c611bf /src
parente2cc02717e2c0180acfd2c5d0160b56721ae2397 (diff)
downloadzig-55e6bd10fe49614cd54eb02dd44c50d0643804c3.tar.gz
zig-55e6bd10fe49614cd54eb02dd44c50d0643804c3.zip
translate-c: use transCreateNodeInfixOp for pointer arithmetic
Diffstat (limited to 'src')
-rw-r--r--src/translate_c.zig12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/translate_c.zig b/src/translate_c.zig
index 8a2a1b6223..ac5c52ee0d 100644
--- a/src/translate_c.zig
+++ b/src/translate_c.zig
@@ -1353,10 +1353,14 @@ fn transCreatePointerArithmeticSignedOp(
const bitcast_node = try usizeCastForWrappingPtrArithmetic(c.arena, rhs_node);
- const arith_args = .{ .lhs = lhs_node, .rhs = bitcast_node };
- const arith_node = try if (is_add) Tag.add.create(c.arena, arith_args) else Tag.sub.create(c.arena, arith_args);
-
- return maybeSuppressResult(c, scope, result_used, arith_node);
+ return transCreateNodeInfixOp(
+ c,
+ scope,
+ if (is_add) .add else .sub,
+ lhs_node,
+ bitcast_node,
+ result_used,
+ );
}
fn transBinaryOperator(