mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
Add VG_(atoll).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6899
This commit is contained in:
parent
ac244a2023
commit
2455b7eaf8
@ -63,6 +63,33 @@ Long VG_(atoll) ( Char* str )
|
||||
return n;
|
||||
}
|
||||
|
||||
Long VG_(atoll16) ( Char* str )
|
||||
{
|
||||
Bool neg = False;
|
||||
Long n = 0;
|
||||
if (*str == '-') { str++; neg = True; };
|
||||
while (True) {
|
||||
Char c = *str;
|
||||
if (c >= '0' && c <= (Char)'9') {
|
||||
n = 16*n + (Long)(c - '0');
|
||||
}
|
||||
else
|
||||
if (c >= 'A' && c <= (Char)'F') {
|
||||
n = 16*n + (Long)((c - 'A') + 10);
|
||||
}
|
||||
else
|
||||
if (c >= 'a' && c <= (Char)'f') {
|
||||
n = 16*n + (Long)((c - 'a') + 10);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
if (neg) n = -n;
|
||||
return n;
|
||||
}
|
||||
|
||||
Long VG_(atoll36) ( Char* str )
|
||||
{
|
||||
Bool neg = False;
|
||||
|
||||
@ -42,7 +42,9 @@ extern Bool VG_(isdigit) ( Char c );
|
||||
Converting strings to numbers
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
// Nb: atoll16 doesn't handle a "0x" prefix.
|
||||
extern Long VG_(atoll) ( Char* str ); // base 10
|
||||
extern Long VG_(atoll16) ( Char* str ); // base 16
|
||||
extern Long VG_(atoll36) ( Char* str ); // base 36
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user