forked from Vhex-Kernel-Core/fxlibc
Lephenixnoir
06f975f75c
The presumed bug where the value computed without the sign overflows even though the negative result can be represented is not actually a problem, because this only happens with signed results and the temporary value is computed as unsigned (thus with extra range).
12 lines
260 B
C
12 lines
260 B
C
#include "stdlib_p.h"
|
|
#include <errno.h>
|
|
|
|
unsigned long int strtoul(char const * restrict ptr, char ** restrict endptr,
|
|
int base)
|
|
{
|
|
unsigned long n = 0;
|
|
int err = strto_int(ptr, endptr, base, (long *)&n, NULL, true);
|
|
if(err != 0) errno = err;
|
|
return n;
|
|
}
|