pub fn overflow() -> u64 
Expand description

Contains overflow & underflow of addition, subtraction, and multiplication.

Additional Information

In order to use this function, panic on overflow must be disabled.

Returns

  • [u64] - The overflow or underflow remaining value.

Examples

use std::{registers::overflow, flags::{disable_panic_on_overflow, enable_panic_on_overflow}};

fn foo() {
   disable_panic_on_overflow();
   let max = u64::max();
   let result = max + 1;
   let overflow_val = overflow();

   assert(result == 0);
   assert(overflow_val == 1);
   enable_panic_on_overflow();
}