ref: 7dd34f1572bf890ed2c415e0a0dd458fb3b06375
parent: 748e7dd4c79f0fef101a30b91252388f945254b9
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Wed Feb 17 04:41:36 EST 2021
Format INT32_MIN as '-2147483648', not '--2147483648'
--- a/src/asm/format.c
+++ b/src/asm/format.c
@@ -182,10 +182,9 @@
if (fmt->type == 'd' || fmt->type == 'f') {
int32_t v = value;
- if (v < 0) {
+ if (v < 0 && v != INT32_MIN) {
sign = '-';
- if (v != INT32_MIN)
- value = -v;
+ value = -v;
}
}
--- /dev/null
+++ b/test/asm/minimum-int.asm
@@ -1,0 +1,8 @@
+m = $8000_0000
+assert m == 1 << 31
+assert m == -(1 << 31)
+assert m == (-2)**31
+
+ println "{m}"
+ println "({12d:m})"
+ println "({-12d:m})"
--- /dev/null
+++ b/test/asm/minimum-int.out
@@ -1,0 +1,3 @@
+$80000000
+( -2147483648)
+(-2147483648 )