ref: 4540277f20b2e33fbd7caefc344ba652bfffb910
parent: fbc9ef5b7b48d515382711489c463d7886b5f358
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Jan 7 07:19:04 EST 2025
fix more minor formatting issues
--- a/3rd/mp/test.c
+++ b/3rd/mp/test.c
@@ -160,7 +160,7 @@
mpvecdigmuladd(b->p, b->top, d, b2->p);
}
if(loops > 1)
- printf("%"PRId64" ns for a %d*%d vecdigmul\n", (nsec()-now)/loops, b->top*Dbits, Dbits);
+ printf("%"PRId64" ns for a %"PRIu32"*%d vecdigmul\n", (nsec()-now)/loops, b->top*Dbits, Dbits);
mpnorm(b2);
printf("0 + %s * %"PRIx64" = %s\n", MP(b), (uint64_t)d, MP(b2));
@@ -185,7 +185,7 @@
mpvecdigmulsub(b->p, b->top, d, b2->p);
}
if(loops > 1)
- printf("%"PRId64" ns for a %d*%d vecdigmul\n", (nsec()-now)/loops, b->top*Dbits, Dbits);
+ printf("%"PRId64" ns for a %"PRIu32"*%d vecdigmul\n", (nsec()-now)/loops, b->top*Dbits, Dbits);
mpnorm(b2);
printf("0 - %s * %"PRIx64" = %s\n", MP(b), (uint64_t)d, MP(b2));
@@ -208,7 +208,7 @@
for(i = 0; i < loops; i++)
mpmul(b, b1, b2);
if(loops > 1)
- printf("%"PRId64" µs for a %d*%d mult\n", (nsec()-now)/(loops*1000),
+ printf("%"PRId64" µs for a %"PRIu32"*%"PRIu32" mult\n", (nsec()-now)/(loops*1000),
b->top*Dbits, b1->top*Dbits);
printf("%s * %s = %s\n", MP(b), MP(b1), MP(b2));
@@ -230,7 +230,7 @@
for(i = 0; i < loops; i++)
mpmul(b, b1, b2);
if(loops > 1)
- printf("%"PRId64" µs for a %d*%d mult\n", (nsec()-now)/(loops*1000), b->top*Dbits, b1->top*Dbits);
+ printf("%"PRId64" µs for a %"PRIu32"*%"PRIu32" mult\n", (nsec()-now)/(loops*1000), b->top*Dbits, b1->top*Dbits);
printf("%s * ", MP(b));
printf("%s = ", MP(b1));
printf("%s\n", MP(b2));
@@ -251,7 +251,7 @@
for(i = 0; i < loops; i++)
mpdigdiv(b->p, d, &q);
if(loops > 1)
- printf("%"PRId64" ns for a %d / %d div\n", (nsec()-now)/loops, 2*Dbits, Dbits);
+ printf("%"PRId64" ns for a %d/%d div\n", (nsec()-now)/loops, 2*Dbits, Dbits);
printf("%s / %"PRIx64" = %"PRIx64"\n", MP(b), (uint64_t)d, (uint64_t)q);
mpfree(b);
}
@@ -269,7 +269,7 @@
for(i = 0; i < loops; i++)
mpdiv(x, y, b2, b3);
if(loops > 1)
- printf("%"PRId64" µs for a %d/%d div\n", (nsec()-now)/(1000*loops),
+ printf("%"PRId64" µs for a %"PRIu32"/%"PRIu32" div\n", (nsec()-now)/(1000*loops),
x->top*Dbits, y->top*Dbits);
printf("%s / %s = %s %s\n", MP(x), MP(y), MP(b2), MP(b3));
mpfree(b2);
@@ -288,7 +288,7 @@
for(i = 0; i < loops; i++)
mpmod(x, y, r);
if(loops > 1)
- printf("%"PRId64" µs for a %d/%d mod\n", (nsec()-now)/(1000*loops),
+ printf("%"PRId64" µs for a %"PRIu32"/%"PRIu32" mod\n", (nsec()-now)/(1000*loops),
x->top*Dbits, y->top*Dbits);
printf("%s mod %s = %s\n", MP(x), MP(y), MP(r));
mpfree(r);
@@ -311,7 +311,7 @@
for(i = 0; i < loops; i++)
mpinvert(x, y, r);
if(loops > 1)
- printf("%"PRId64" µs for a %d in %d invert\n", (nsec()-now)/(1000*loops),
+ printf("%"PRId64" µs for a %"PRIu32" in %"PRIu32" invert\n", (nsec()-now)/(1000*loops),
x->top*Dbits, y->top*Dbits);
printf("%s**-1 mod %s = %s\n", MP(x), MP(y), MP(r));
mpmul(r, x, d1);
@@ -370,7 +370,7 @@
for(i = 0; i < loops; i++)
mpexp(b, e, m, res);
if(loops > 1)
- printf("%"PRIu64"µs for a %d to the %d bit exp\n", (nsec()-now)/(loops*1000),
+ printf("%"PRIu64"µs for a %"PRIu32" to the %"PRIu32" bit exp\n", (nsec()-now)/(loops*1000),
b->top*Dbits, e->top*Dbits);
if(m != nil)
printf("%s ^ %s mod %s == %s\n", MP(b), MP(e), MP(m), MP(res));
--- a/3rd/mp/test/convtest.c
+++ b/3rd/mp/test/convtest.c
@@ -73,7 +73,7 @@
e = sign*(1<<mag);
else
e = sign > 0 ? (1U<<31)-1 : 1U<<31;
-MPTOX_END(mptoi, "%#x")
+MPTOX_END(mptoi, "%d")
MPTOX(test_mptoui, uint32_t, mptoui)
if(mag < 32 && sign > 0)
@@ -80,7 +80,7 @@
e = 1U<<mag;
else
e = sign > 0 ? -1 : 0;
-MPTOX_END(mptoui, "%#x")
+MPTOX_END(mptoui, "%"PRIu32)
MPTOX(test_mptov, int64_t, mptov)
@@ -88,7 +88,7 @@
e = sign*(1LL<<mag);
else
e = sign > 0 ? (1ULL<<63)-1 : 1ULL<<63;
-MPTOX_END(mptov, "%#"PRIx64)
+MPTOX_END(mptov, "%"PRId64)
MPTOX(test_mptouv, uint64_t, mptouv)
if(mag < 64 && sign > 0)
@@ -95,7 +95,7 @@
e = 1ULL<<mag;
else
e = sign > 0 ? -1ULL : 0;
-MPTOX_END(mptouv, "%#"PRIx64)
+MPTOX_END(mptouv, "%"PRIu64)
XTOMP(test_itomp, int, itomp)
if(mag >= 31) continue;
--- a/flisp.h
+++ b/flisp.h
@@ -256,7 +256,7 @@
#define argcount(nargs, c) \
do{ \
if(__unlikely(nargs != c)) \
- lerrorf(FL_ArgError, "arity mismatch: wanted %d, got %d", c, nargs); \
+ lerrorf(FL_ArgError, "arity mismatch: wanted %"PRIu32", got %"PRIu32, (uint32_t)c, nargs); \
}while(0)
typedef struct {
--- a/meson.build
+++ b/meson.build
@@ -22,6 +22,8 @@
'-Werror=odr',
'-Werror=strict-aliasing',
'-Wformat=2',
+ '-Wformat-signedness',
+ '-Wformat-truncation=2',
'-Wint-to-pointer-cast',
'-Wmissing-prototypes',
'-Wno-format-y2k',