Cwerg
Cwerg copied to clipboard
finalize the semantics of those opcodes with potentially undefined behavior
- mod with signed ints
- div/mod with zero divisors
- shifts with shift amounts exceeding the bitwidth of the operand
- conversions that widen and change from signed to unsigned
see comments interleaved with opcode description.
suggestion from a reddit user
Don't forget to maintain the identity:
div a 0 -> 0
mod a 0 -> a
(it helps to think of "0" as "2bitwidth, but wrapped around")