diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-09 19:47:14 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-09 19:47:14 +0100 |
commit | 4f347e7a16d8b0144c84e0a349f66fcd3b473f02 (patch) | |
tree | 08a4417a7d8674784f55b0ae3aa04ee32a2c8096 | |
parent | b435a5824bf88b9bddddb81e645623caa2e334bc (diff) | |
download | pack-4f347e7a16d8b0144c84e0a349f66fcd3b473f02.tar.gz pack-4f347e7a16d8b0144c84e0a349f66fcd3b473f02.tar.xz pack-4f347e7a16d8b0144c84e0a349f66fcd3b473f02.zip |
Make sure constants don't become unsigned
-rw-r--r-- | test_gen.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -88,7 +88,7 @@ void generate_simple(FILE *out, char fmt, const char *type, intmax_t min, uintma if (sign) { fprintf(out, "\tCHECK_UNPACK(DATA(%s), \"%s%c\", &%c);\n", i2bytes(endian[e].e, size, min), endian[e].prefix, fmt, fmt); - fprintf(out, "\tCHECK_EQUAL(PRIdMAX, (intmax_t)%c, INTMAX_C(%" PRIdMAX "));\n", fmt, min); + fprintf(out, "\tCHECK_EQUAL(PRIdMAX, (intmax_t)%c, -INTMAX_C(%" PRIdMAX ")-1);\n", fmt, -(min + 1)); } fprintf(out, "\tCHECK_UNPACK(DATA(%s), \"%s%c\", &%c);\n", u2bytes(endian[e].e, size, max), endian[e].prefix, fmt, fmt); |