Add integer truncation and extension methods
This provides `.truncate()`, `.saturating_truncate()`, `.checked_truncate()`, and `.extend()`. These only work within the same signedness (use `.cast_signed()` and `.cast_unsigned()` to change sign). The truncation methods only work to smaller (or equal) types. `.extend()` only works to larger (or equal) types. For the purposes of truncation and extending, `usize` is considered larger than `u16` or `u8`. This is consistent with `From`/`Into` conversions. Adding these methods results in needing to update the output of one test that gets a new method-name similarity result. Co-authored-by: Amanieu d'Antras <[email protected]>
J
Josh Triplett committed
ea421bf991b797fbd574aa138ce4b31ae28cf483
Parent: 0f6ad8d