On Wednesday, 18 May 2016 at 08:38:07 UTC, Era Scarecrow wrote:
try {} // Considers the result of 1 line of basic math to
be caught by:
carry {} //only activates if carry is set
overflow {} //if overflowed during some math
modulus(m){} //get the remainder as m after a division
operation
mult(dx) {} //get upper 32/64/whatever after a multiply and
set as dx
Of course I'd understand if some hardware doesn't offer such
support, so the else could be thrown in to allow a workaround
code to detect such an event, or only allow it if it's a
compliant architecture. Although workaround detection is always
possible, just not as fast as hardware supplied.
https://code.dlang.org/packages/checkedint
https://dlang.org/phobos/core_checkedint.html