Repository navigation
Commit fa0d183
authored
Rollup merge of #163099 - maxdexh:int-from-str-loop-unchecked, r=Darksonn
Use wrapping arithmetic in `from_str_radix`
Uses wrapping arithmetic in the fast/unchecked loop of `from_str_radix`.
Originally this PR was written using unchecked arithmetic:
This generates identical assembly when compiling with `-O`: https://godbolt.org/z/Gvb7G9YEM
However, it significantly simplifies the asm of `-O -Coverflow-checks` (e.g. RfL): https://godbolt.org/z/Pah9fMfrd
More precisely, the `-O -Coverflow-checks` output becomes identical to the `-O` one: https://godbolt.org/z/WoYMThP8e
In conclusion, it makes more sense to use wrapping operations here.1 file changed
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1576 | 1576 | | |
1577 | 1577 | | |
1578 | 1578 | | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
1579 | 1589 | | |
1580 | 1590 | | |
1581 | 1591 | | |
| |||
1819 | 1829 | | |
1820 | 1830 | | |
1821 | 1831 | | |
1822 | | - | |
1823 | | - | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
1824 | 1837 | | |
1825 | | - | |
| 1838 | + | |
1826 | 1839 | | |
1827 | | - | |
| 1840 | + | |
1828 | 1841 | | |
1829 | 1842 | | |
1830 | 1843 | | |
1831 | 1844 | | |
1832 | 1845 | | |
1833 | | - | |
| 1846 | + | |
1834 | 1847 | | |
1835 | | - | |
| 1848 | + | |
1836 | 1849 | | |
1837 | 1850 | | |
1838 | 1851 | | |
| |||
0 commit comments