Commit 55e6bd10fe

Evan Haas <evan@lagerdata.com>
2021-04-19 05:55:05
translate-c: use transCreateNodeInfixOp for pointer arithmetic
1 parent e2cc027
Changed files (1)
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(