math::checked
math::checked provides safe integer arithmetic functions that check for overflow.
Index
Functions
fn addi16(a: i16, b: i16) (i16, bool);
fn addi32(a: i32, b: i32) (i32, bool);
fn addi64(a: i64, b: i64) (i64, bool);
fn addi8(a: i8, b: i8) (i8, bool);
fn addu16(a: u16, b: u16) (u16, bool);
fn addu32(a: u32, b: u32) (u32, bool);
fn addu64(a: u64, b: u64) (u64, bool);
fn addu8(a: u8, b: u8) (u8, bool);
fn muli16(a: i16, b: i16) (i16, bool);
fn muli32(a: i32, b: i32) (i32, bool);
fn muli64(a: i64, b: i64) (i64, bool);
fn muli8(a: i8, b: i8) (i8, bool);
fn mulu16(a: u16, b: u16) (u16, bool);
fn mulu32(a: u32, b: u32) (u32, bool);
fn mulu64(a: u64, b: u64) (u64, bool);
fn mulu8(a: u8, b: u8) (u8, bool);
fn subi16(a: i16, b: i16) (i16, bool);
fn subi32(a: i32, b: i32) (i32, bool);
fn subi64(a: i64, b: i64) (i64, bool);
fn subi8(a: i8, b: i8) (i8, bool);
fn subu16(a: u16, b: u16) (u16, bool);
fn subu32(a: u32, b: u32) (u32, bool);
fn subu64(a: u64, b: u64) (u64, bool);
fn subu8(a: u8, b: u8) (u8, bool);
Functions
fn addi16
fn addi16(a: i16, b: i16) (i16, bool);
Adds 'a' and 'b', returning the result and whether overflow occurred.
fn addi32
fn addi32(a: i32, b: i32) (i32, bool);
Adds 'a' and 'b', returning the result and whether overflow occurred.
fn addi64
fn addi64(a: i64, b: i64) (i64, bool);
Adds 'a' and 'b', returning the result and whether overflow occurred.
fn addi8
fn addi8(a: i8, b: i8) (i8, bool);
Adds 'a' and 'b', returning the result and whether overflow occurred.
fn addu16
fn addu16(a: u16, b: u16) (u16, bool);
Adds 'a' and 'b', returning the result and whether overflow occurred.
fn addu32
fn addu32(a: u32, b: u32) (u32, bool);
Adds 'a' and 'b', returning the result and whether overflow occurred.
fn addu64
fn addu64(a: u64, b: u64) (u64, bool);
Adds 'a' and 'b', returning the result and whether overflow occurred.
fn addu8
fn addu8(a: u8, b: u8) (u8, bool);
Adds 'a' and 'b', returning the result and whether overflow occurred.
fn muli16
fn muli16(a: i16, b: i16) (i16, bool);
Multiplies 'a' and 'b' returning the result and whether overflow occurred.
fn muli32
fn muli32(a: i32, b: i32) (i32, bool);
Multiplies 'a' and 'b' returning the result and whether overflow occurred.
fn muli64
fn muli64(a: i64, b: i64) (i64, bool);
Multiplies 'a' and 'b' returning the result and whether overflow occurred.
fn muli8
fn muli8(a: i8, b: i8) (i8, bool);
Multiplies 'a' and 'b' returning the result and whether overflow occurred.
fn mulu16
fn mulu16(a: u16, b: u16) (u16, bool);
Multiplies 'a' and 'b' returning the result and whether overflow occurred.
fn mulu32
fn mulu32(a: u32, b: u32) (u32, bool);
Multiplies 'a' and 'b' returning the result and whether overflow occurred.
fn mulu64
fn mulu64(a: u64, b: u64) (u64, bool);
Multiplies 'a' and 'b' returning the result and whether overflow occurred.
fn mulu8
fn mulu8(a: u8, b: u8) (u8, bool);
Multiplies 'a' and 'b' returning the result and whether overflow occurred.
fn subi16
fn subi16(a: i16, b: i16) (i16, bool);
Subtracts 'b' from 'a', returning the result and whether overflow occurred.
fn subi32
fn subi32(a: i32, b: i32) (i32, bool);
Subtracts 'b' from 'a', returning the result and whether overflow occurred.
fn subi64
fn subi64(a: i64, b: i64) (i64, bool);
Subtracts 'b' from 'a', returning the result and whether overflow occurred.
fn subi8
fn subi8(a: i8, b: i8) (i8, bool);
Subtracts 'b' from 'a', returning the result and whether overflow occurred.
fn subu16
fn subu16(a: u16, b: u16) (u16, bool);
Subtracts 'b' from 'a', returning the result and whether overflow occurred.
fn subu32
fn subu32(a: u32, b: u32) (u32, bool);
Subtracts 'b' from 'a', returning the result and whether overflow occurred.
fn subu64
fn subu64(a: u64, b: u64) (u64, bool);
Subtracts 'b' from 'a', returning the result and whether overflow occurred.
fn subu8
fn subu8(a: u8, b: u8) (u8, bool);
Subtracts 'b' from 'a', returning the result and whether overflow occurred.