diff options
Diffstat (limited to 'Integers can overflow if compiled with --release.md')
-rw-r--r-- | Integers can overflow if compiled with --release.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Integers can overflow if compiled with --release.md b/Integers can overflow if compiled with --release.md new file mode 100644 index 0000000..94d80ca --- /dev/null +++ b/Integers can overflow if compiled with --release.md @@ -0,0 +1,11 @@ +[[Rust]] + +Integers that overflow wrap around. ie in an i8 256 -> 0, 257 -> 1, etc. + +The standard library includes families of methods for primitive numeric types to handle wrapping: +- `wrapping_*`: wrap in all modes +- `checked_*`: return None if overflow +- `overflowing_*`: return val + bool that indicates whether overflow occurred +- `saturating_*`: saturate at the minimum or maximum values + +[[Saturating a value when wrapping]] |