mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Fix int parsing with base 2 and 16 (#107)
This commit is contained in:
parent
fb7b7c6e21
commit
813e11b90b
4 changed files with 19 additions and 6 deletions
|
@ -51,10 +51,10 @@ uintmax_t strtoumax(const char *s, char **endptr, int base) {
|
|||
} else {
|
||||
base = 10;
|
||||
}
|
||||
} else if (*s == '0') {
|
||||
++s;
|
||||
if (base == 2 && *s == 'b' && *s == 'B') ++s;
|
||||
if (base == 16 && *s == 'x' && *s == 'X') ++s;
|
||||
} else if (*p == '0') {
|
||||
++p;
|
||||
if (base == 2 && (*p == 'b' || *p == 'B')) ++p;
|
||||
if (base == 16 && (*p == 'x' || *p == 'X')) ++p;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue