mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Fix strtol
This commit is contained in:
parent
1df136323b
commit
5eddadafbd
17 changed files with 83 additions and 105 deletions
|
@ -17,9 +17,12 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/strlol.internal.h"
|
||||
#include "libc/limits.h"
|
||||
|
||||
unsigned long strtoul(const char *s, char **endptr, int optional_base) {
|
||||
return STRLOL(s, endptr, optional_base, ULONG_MIN, ULONG_MAX);
|
||||
unsigned long long res;
|
||||
res = strtoimax(s, endptr, optional_base);
|
||||
if (res < ULONG_MIN) return ULONG_MIN;
|
||||
if (res > ULONG_MAX) return ULONG_MAX;
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue