Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Is this a hack that should not be allowed?

Yep. This is a hack that should not be allowed.

If yo want to use it, you should create your own type, with explicit modular arithmetic. Not try to ride architectural dependent assumptions.



Fwiw, Rust provides checked_op, saturating_op, and wrapping_op versions of arithmetic, as well as a Wrapping … wrapper

https://doc.rust-lang.org/std/num/struct.Wrapping.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: