-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use only fixed-width uints in the C itoa functions (#702)
* Use only fixed-width uints in the C itoa functions The existing logic for decimal encoding of signed ints was a bit more complicated than necessary in its handling for negative numbers, mostly because of negation overflowing for INT_MIN. But the absolute value of the smallest signed Int16 does fit into an unsigned Word16 without overflowing, allowing some simplification. Additionally, on hardware with slow integer division instructions, fast division-by-known-divisor is typically faster for unsigned types, so this change may lead to a slight speed-up on such platforms. (We could almost certainly produce slightly better code still for these platforms by hand, for example by exploiting the fact that after the first division the numbers are small enough that a quotient by ten can be extracted with a single mulhi and no shift.) * Remove a dead branch in `integerDec` If the absolute value of the input is small enough to enter this branch, then it fits in an Int and takes the very first branch instead.
- Loading branch information
Showing
5 changed files
with
90 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.