zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit bdb90a07bbf0fdedca71f5deace7087bc562b437 (tree)
parent dcbc52ec85d00fbd3603c314aaaab98fb3866892
Author: Travis Staloch <twostepted@gmail.com>
Date:   Wed,  8 Sep 2021 16:30:11 -0700

sat-arithmetic: fixups zig fmt / astcheck

Diffstat:
Msrc/AstGen.zig | 2+-
Msrc/codegen/c.zig | 11+++++------
2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/AstGen.zig b/src/AstGen.zig @@ -2786,7 +2786,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); diff --git a/src/codegen/c.zig b/src/codegen/c.zig @@ -1317,7 +1317,6 @@ fn airWrapOp( fn airSatOp( o: *Object, inst: Air.Inst.Index, - str_op: [*:0]const u8, fn_op: [*:0]const u8, ) !CValue { if (o.liveness.isUnused(inst)) @@ -1328,12 +1327,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 f.fail("TODO: C backend: airSatOp for large integers", .{}); }