This defines some traits so we can replace ops with method calls of the respective traits (provided they're in scope) without worrying about argument types (hopefully)
The traits are:
- AddPanic, SubPanic, MulPanic, DivPanic, RemPanic, ShlPanic, ShrPanic, NegPanic
- AddWrap, SubWrap, Mulwrap, DivWrap, RemWrap, ShlWrap, ShrWrap, NegWrap
- AddSaturate, SubSaturate, MulSaturate
The *Panic
traits all panic on overflow, the *Wrap
traits wrap around and the
*Saturate
traits saturate.
Note: This needs a nightly compiler because it uses the specialization feature.