Add chibicc
This program popped up on Hacker News recently. It's the only modern compiler I've ever seen that doesn't have dependencies and is easily modified. So I added all of the missing GNU extensions I like to use which means it might be possible soon to build on non-Linux and have third party not vendor gcc binaries.
This commit is contained in:
@@ -37,10 +37,10 @@
|
||||
* @see strtoumax
|
||||
*/
|
||||
intmax_t strtoimax(const char *s, char **endptr, int base) {
|
||||
bool neg;
|
||||
uintmax_t x;
|
||||
intmax_t res;
|
||||
unsigned diglet, bits;
|
||||
bool neg, islong, isunsigned;
|
||||
|
||||
x = 0;
|
||||
bits = 0;
|
||||
@@ -104,8 +104,6 @@ intmax_t strtoimax(const char *s, char **endptr, int base) {
|
||||
}
|
||||
}
|
||||
|
||||
if ((isunsigned = *s == 'u' || *s == 'U')) s++;
|
||||
if ((islong = *s == 'l' || *s == 'L')) s++;
|
||||
if (endptr) *endptr = s;
|
||||
|
||||
if (neg) {
|
||||
@@ -114,13 +112,5 @@ intmax_t strtoimax(const char *s, char **endptr, int base) {
|
||||
res = x;
|
||||
}
|
||||
|
||||
if (isunsigned) {
|
||||
if (islong) {
|
||||
res = (uint64_t)res;
|
||||
} else {
|
||||
res = (uint32_t)res;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user