diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/stdlib/integers.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stdlib/integers.c b/src/stdlib/integers.c index 7250e2a2..7c623663 100644 --- a/src/stdlib/integers.c +++ b/src/stdlib/integers.c @@ -28,9 +28,13 @@ public int Int$print(FILE *f, Int_t i) { static inline Text_t _int64_to_text(int64_t n) { + if (n == INT64_MIN) + return Text("-9223372036854775808"); + char buf[21] = {[20]=0}; // Big enough for INT64_MIN + '\0' char *p = &buf[19]; bool negative = n < 0; + if (negative) n = -n; // Safe to do because we checked for INT64_MIN earlier do { *(p--) = '0' + (n % 10); |
