diff options
Diffstat (limited to 'src/stdlib/print.c')
| -rw-r--r-- | src/stdlib/print.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/stdlib/print.c b/src/stdlib/print.c index 7da1343f..bc5b01c6 100644 --- a/src/stdlib/print.c +++ b/src/stdlib/print.c @@ -1,6 +1,7 @@ // This file defines some of the helper functions used for printing values #include <ctype.h> +#include <gc.h> #include <stdio.h> #include <string.h> #include <unistd.h> @@ -10,22 +11,6 @@ #include "util.h" public -int _print_int(FILE *f, int64_t n) { - char buf[21] = {[20] = 0}; // Big enough for INT64_MIN + '\0' - char *p = &buf[19]; - bool negative = n < 0; - - do { - *(p--) = '0' + (n % 10); - n /= 10; - } while (n > 0); - - if (negative) *(p--) = '-'; - - return fwrite(p + 1, sizeof(char), (size_t)(&buf[19] - p), f); -} - -public int _print_uint(FILE *f, uint64_t n) { char buf[21] = {[20] = 0}; // Big enough for UINT64_MAX + '\0' char *p = &buf[19]; |
