robertmuth / Cwerg

The best C-like language that can be implemented in 10kLOC.
Apache License 2.0
477 stars 14 forks source link

finalize the semantics of those opcodes with potentially undefined behavior #5

Open robertmuth opened 3 years ago

robertmuth commented 3 years ago

see comments interleaved with opcode description.

robertmuth commented 3 years ago

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")