mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Format INT32_MIN as '-2147483648', not '--2147483648'
This commit is contained in:
@@ -182,9 +182,8 @@ void fmt_PrintNumber(char *buf, size_t bufLen, struct FormatSpec const *fmt, uin
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
8
test/asm/minimum-int.asm
Normal file
8
test/asm/minimum-int.asm
Normal file
@@ -0,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})"
|
||||
0
test/asm/minimum-int.err
Normal file
0
test/asm/minimum-int.err
Normal file
3
test/asm/minimum-int.out
Normal file
3
test/asm/minimum-int.out
Normal file
@@ -0,0 +1,3 @@
|
||||
$80000000
|
||||
( -2147483648)
|
||||
(-2147483648 )
|
||||
Reference in New Issue
Block a user