mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 08:14:48 +00:00
translate-c: add tests for div & rem assignment
Signed-off-by: Jadon Fowler <j@jadon.io>
This commit is contained in:
parent
a255b0f842
commit
b9cb1e0d83
@ -2381,6 +2381,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
||||
\\ a &= (a &= 1);
|
||||
\\ a |= (a |= 1);
|
||||
\\ a ^= (a ^= 1);
|
||||
\\ a /= (a /= 1);
|
||||
\\ a %= (a %= 1);
|
||||
\\ a >>= (a >>= 1);
|
||||
\\ a <<= (a <<= 1);
|
||||
\\}
|
||||
@ -2417,6 +2419,16 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
||||
\\ ref.* = ref.* ^ @as(c_int, 1);
|
||||
\\ break :blk ref.*;
|
||||
\\ });
|
||||
\\ a /= (blk: {
|
||||
\\ const ref = &a;
|
||||
\\ ref.* = ref.* / @as(c_int, 1);
|
||||
\\ break :blk ref.*;
|
||||
\\ });
|
||||
\\ a %= (blk: {
|
||||
\\ const ref = &a;
|
||||
\\ ref.* = ref.* % @as(c_int, 1);
|
||||
\\ break :blk ref.*;
|
||||
\\ });
|
||||
\\ a >>= @intCast(@import("std").math.Log2Int(c_int), (blk: {
|
||||
\\ const ref = &a;
|
||||
\\ ref.* = ref.* >> @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user