Changeset 7942 in vbox for trunk/src/VBox/Runtime/common/string/strtonum.cpp
- Timestamp:
- Apr 11, 2008 8:32:20 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 29576
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/strtonum.cpp
r7169 r7942 106 106 RTDECL(int) RTStrToUInt64Ex(const char *pszValue, char **ppszNext, unsigned uBase, uint64_t *pu64) 107 107 { 108 const char *psz = pszValue; 108 const char *psz = pszValue; 109 int iShift; 110 int rc; 111 uint64_t u64; 112 unsigned char uch; 109 113 110 114 /* … … 153 157 * Note: We only support ascii digits at this time... :-) 154 158 */ 155 i nt iShift = g_auchShift[uBase];159 iShift = g_auchShift[uBase]; 156 160 pszValue = psz; /* (Prefix and sign doesn't count in the digit counting.) */ 157 int rc = VINF_SUCCESS; 158 uint64_t u64 = 0; 159 unsigned char uch; 161 rc = VINF_SUCCESS; 162 u64 = 0; 160 163 while ((uch = (unsigned char)*psz) != 0) 161 164 { 162 165 unsigned char chDigit = g_auchDigits[uch]; 166 uint64_t u64Prev; 167 163 168 if (chDigit >= uBase) 164 169 break; 165 170 166 u int64_t u64Prev = u64;171 u64Prev = u64; 167 172 u64 *= uBase; 168 173 u64 += chDigit; … … 534 539 RTDECL(int) RTStrToInt64Ex(const char *pszValue, char **ppszNext, unsigned uBase, int64_t *pi64) 535 540 { 536 const char *psz = pszValue; 541 const char *psz = pszValue; 542 int iShift; 543 int rc; 544 int64_t i64; 545 unsigned char uch; 537 546 538 547 /* … … 581 590 * Note: We only support ascii digits at this time... :-) 582 591 */ 583 i nt iShift = g_auchShift[uBase]; /** @todo test this, it's probably not 100% right yet. */592 iShift = g_auchShift[uBase]; /** @todo test this, it's probably not 100% right yet. */ 584 593 pszValue = psz; /* (Prefix and sign doesn't count in the digit counting.) */ 585 int rc = VINF_SUCCESS; 586 int64_t i64 = 0; 587 unsigned char uch; 594 rc = VINF_SUCCESS; 595 i64 = 0; 588 596 while ((uch = (unsigned char)*psz) != 0) 589 597 { 590 598 unsigned char chDigit = g_auchDigits[uch]; 599 int64_t i64Prev; 600 591 601 if (chDigit >= uBase) 592 602 break; 593 603 594 i nt64_t i64Prev = i64;604 i64Prev = i64; 595 605 i64 *= uBase; 596 606 i64 += chDigit;
Note:
See TracChangeset
for help on using the changeset viewer.