make decimal math ops correctly report overflow

This commit is contained in:
Folkert 2021-07-18 22:04:32 +02:00
parent 2b5ec3dcf1
commit 23ea151d5f
8 changed files with 155 additions and 165 deletions

View file

@ -1,6 +1,10 @@
const std = @import("std");
const always_inline = std.builtin.CallOptions.Modifier.always_inline;
pub fn WithOverflow(comptime T: type) type {
return extern struct { value: T, has_overflowed: bool };
}
// If allocation fails, this must cxa_throw - it must not return a null pointer!
extern fn roc_alloc(size: usize, alignment: u32) callconv(.C) ?*c_void;