Studying Hare's `math::checked` standard library... There's a suite of functions...
alcinnz @alcinnz@floss.social
Studying Hare's `math::checked` standard library...
There's a suite of functions (for different types) adds its operands & checks the sign of the inputs & output to see if it overflowed. Or for unsigned args it checks if the output's less than an input.
And then there's variants for subtraction.
For multiplication it truncates the bits to see if it chopped any 1s off. If the operands are signed, it also does an unsigned multiplication.
1/2?