Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

wrapping_integer

wrapping_integer

wrapping_integer -- abstract ancestor of wrap-around integer numbers

wrapping_integer is the abstract ancestor of integer numbers that have min and
max values and operations with wrap-around semantics.
this integer as an array of bytes (little endian)

redefines:

multiplication, with check for overflow

redefines:


redefines:

exponentiation for positive exponent

'zero ** zero' is permitted and results in 'one'.

redefines:


redefines:

exponentiation with overflow checking semantics

'zero **? zero' is permitted and results in 'one'.

redefines:

exponentiation with saturating semantics

'zero **^ zero' is permitted and results in 'one'.

redefines:

exponentiation with wrap-around semantics

'zero **° zero' is permitted and results in 'one'.

redefines:


redefines:

addition, with check for overflow

redefines:


redefines:


redefines:


redefines:

subtraction, with check for overflow

redefines:


redefines:


redefines:


redefines:


redefines:

check if this type of wrapping_integer is bounded

wrapping_integers are assumed to be a bound set by default, so
this returns true unless redefined by an implementation

redefines:

count the number of 1 bits in the binary representation of this
integer.
would addition wrapping_integer.this + other cause an overflow or underflow?
would exponentiation 'this ** other' cause an overflow?
would multiplication wrapping_integer.this * other cause an overflow or underflow?
would subtraction wrapping_integer.this - other cause an overflow or underflow?
negation, with check for overflow

redefines:

preconditions used in 'numeric' for basic operations: true if the
operation is permitted for the given values

redefines:

overflow checking operations

redefines:

saturating operations

redefines:

neg, add, sub, mul with wrap-around semantics
bitwise NOT

redefines:

would negation -wrapping_integer.this cause an overflow?