mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
parent
7d6fcf0831
commit
8bd07fb1be
@ -20771,7 +20771,7 @@ fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
|
||||
try sema.requireRuntimeBlock(block, inst_data.src(), operand_src);
|
||||
if (dest_ty.intInfo(mod).bits == 0) {
|
||||
if (block.wantSafety()) {
|
||||
const ok = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_eq_optimized else .cmp_eq, operand, try sema.addConstant(operand_ty, try mod.intValue(operand_ty, 0)));
|
||||
const ok = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_eq_optimized else .cmp_eq, operand, try sema.addConstant(operand_ty, try mod.floatValue(operand_ty, 0.0)));
|
||||
try sema.addSafetyCheck(block, ok, .integer_part_out_of_bounds);
|
||||
}
|
||||
return sema.addConstant(dest_ty, try mod.intValue(dest_ty, 0));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user