ruma / js_int

JavaScript-interoperable integer types for Rust
MIT License
16 stars 8 forks source link

How to implement signed over- / underflow for Int? #1

Open jplatte opened 5 years ago

jplatte commented 5 years ago

Rust specifies that, when debug assertions are disabled, signed integers over- and underflow. It have not found any documentation about whether bitmasks on negative integers are defined. If they are defined, this is (probably) easy to implement. Otherwise, any implementation would (probably) not be much faster than just having range-check assertions in both debug and release mode.

jplatte commented 5 years ago

Also relevant for non-release builds if we want to implement wrapping_* and overflowing_* methods for Int.