Skip to content

Commit

Permalink
sat-arithmetic: fixups zig fmt / astcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
travisstaloch committed Sep 8, 2021
1 parent 1659b97 commit ee220a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/std/zig/tokenizer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1999,9 +1999,9 @@ test "tokenizer - invalid builtin identifiers" {
}

test "tokenizer - saturating" {
try testTokenize("<<", &.{ .angle_bracket_angle_bracket_left });
try testTokenize("<<|", &.{ .angle_bracket_angle_bracket_left_pipe });
try testTokenize("<<|=", &.{ .angle_bracket_angle_bracket_left_pipe_equal });
try testTokenize("<<", &.{.angle_bracket_angle_bracket_left});
try testTokenize("<<|", &.{.angle_bracket_angle_bracket_left_pipe});
try testTokenize("<<|=", &.{.angle_bracket_angle_bracket_left_pipe_equal});
}

fn testTokenize(source: [:0]const u8, expected_tokens: []const Token.Tag) !void {
Expand Down
2 changes: 1 addition & 1 deletion src/AstGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2746,7 +2746,7 @@ fn assignShift(
fn assignShiftSat(
gz: *GenZir,
scope: *Scope,
infix_node: ast.Node.Index,
infix_node: Ast.Node.Index,
op_inst_tag: Zir.Inst.Tag,
) InnerError!void {
try emitDbgNode(gz, infix_node);
Expand Down
10 changes: 5 additions & 5 deletions src/codegen/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1269,12 +1269,12 @@ fn airSatOp(
const int_info = inst_ty.intInfo(o.dg.module.getTarget());
const bits = int_info.bits;

// if it's an unsigned int with non-arbitrary bit size then we can just add
const ok_bits = switch (bits) {
8, 16, 32, 64, 128 => true,
else => false,
};
switch (bits) {
8, 16, 32, 64, 128 => {},
else => return o.dg.fail("TODO: C backend: airSatOp for non power of 2 integers", .{}),
}

// if it's an unsigned int with non-arbitrary bit size then we can just add
if (bits > 64) {
return o.dg.fail("TODO: C backend: airSatOp for large integers", .{});
}
Expand Down

0 comments on commit ee220a8

Please sign in to comment.