mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:57:36 +00:00
Add really cheap atol() since sizeof(int) == sizeof(long) here anyway.
This commit is contained in:
parent
f394e3486a
commit
9b70808ab5
2 changed files with 8 additions and 1 deletions
|
@ -103,11 +103,17 @@ int atoi(const char* str)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (str[i] < '0' || str[i] > '9')
|
if (str[i] < '0' || str[i] > '9')
|
||||||
return 0;
|
return value;
|
||||||
value = value * 10;
|
value = value * 10;
|
||||||
value += str[i] - '0';
|
value += str[i] - '0';
|
||||||
}
|
}
|
||||||
return isNegative ? -value : value;
|
return isNegative ? -value : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long atol(const char* str)
|
||||||
|
{
|
||||||
|
static_assert(sizeof(int) == sizeof(long));
|
||||||
|
return atoi(str);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ void* calloc(size_t nmemb, size_t);
|
||||||
void* realloc(void *ptr, size_t);
|
void* realloc(void *ptr, size_t);
|
||||||
char* getenv(const char* name);
|
char* getenv(const char* name);
|
||||||
int atoi(const char*);
|
int atoi(const char*);
|
||||||
|
long atol(const char*);
|
||||||
|
|
||||||
void exit(int status) __NORETURN;
|
void exit(int status) __NORETURN;
|
||||||
void abort() __NORETURN;
|
void abort() __NORETURN;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue