[cfe-commits] r164639 - /cfe/trunk/lib/Lex/LiteralSupport.cpp
Jordan Rose
jordan_rose at apple.com
Tue Sep 25 15:32:51 PDT 2012
Author: jrose
Date: Tue Sep 25 17:32:51 2012
New Revision: 164639
URL: http://llvm.org/viewvc/llvm-project?rev=164639&view=rev
Log:
Rename CanFitInto64Bits to alwaysFitsInto64Bits per discussion on IRC.
This makes the behavior clearer concerning literals with the maximum
number of digits. For a 32-bit example, 4,000,000,000 is a valid uint32_t,
but 5,000,000,000 is not, so we'd have to count 10-digit decimal numbers
as "unsafe" (meaning we have to check for overflow when parsing them,
just as we would for numbers with 11 digits or higher). This is the same,
only with 64 bits to play with.
No functionality change.
Modified:
cfe/trunk/lib/Lex/LiteralSupport.cpp
Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=164639&r1=164638&r2=164639&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Tue Sep 25 17:32:51 2012
@@ -752,7 +752,7 @@
}
}
-static bool CanFitInto64Bits(unsigned Radix, unsigned NumDigits) {
+static bool alwaysFitsInto64Bits(unsigned Radix, unsigned NumDigits) {
switch (Radix) {
case 2:
return NumDigits <= 64;
@@ -778,7 +778,7 @@
// handles the common cases that matter (small decimal integers and
// hex/octal values which don't overflow).
const unsigned NumDigits = SuffixBegin - DigitsBegin;
- if (CanFitInto64Bits(radix, NumDigits)) {
+ if (alwaysFitsInto64Bits(radix, NumDigits)) {
uint64_t N = 0;
for (const char *Ptr = DigitsBegin; Ptr != SuffixBegin; ++Ptr)
N = N * radix + HexDigitValue(*Ptr);
More information about the cfe-commits
mailing list