diff options
author | Jason Gross <jgross@mit.edu> | 2017-11-03 12:47:16 -0400 |
---|---|---|
committer | Jason Gross <jgross@mit.edu> | 2017-11-03 12:55:19 -0400 |
commit | 28a1eadb8eff4476078b6fd3fc425f0f4e5e9e45 (patch) | |
tree | 712afed6fb59a14a1ed0e7d9ea2f49d565d81fef /src/Specific/Framework | |
parent | 952b835169cdba0900be458a48f9544572db0b5c (diff) |
Add PRI{u,x}limb for printf formats
This is to fix
```
src/Specific/Framework/bench/fibe.c: In function ‘fe_print’:
src/Specific/Framework/bench/fibe.c:130:5: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint32_t’ [-Wformat=]
printf("0x%016llx)<< %lu) + ", x[i], limb_weight_gaps[i-1]);
^
src/Specific/Framework/bench/fibe.c:130:5: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint32_t’ [-Wformat=]
src/Specific/Framework/bench/fibe.c:132:3: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint32_t’ [-Wformat=]
printf("0x%016llx", x[0]);
^
```
Diffstat (limited to 'src/Specific/Framework')
-rw-r--r-- | src/Specific/Framework/bench/fibe.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Specific/Framework/bench/fibe.c b/src/Specific/Framework/bench/fibe.c index f52770037..bcc13d243 100644 --- a/src/Specific/Framework/bench/fibe.c +++ b/src/Specific/Framework/bench/fibe.c @@ -1,6 +1,7 @@ #include <assert.h> #include <stdint.h> #include <stdio.h> +#include <inttypes.h> typedef unsigned int uint128_t __attribute__((mode(TI))); #ifndef modulus_bytes_val @@ -11,6 +12,14 @@ typedef unsigned int uint128_t __attribute__((mode(TI))); #define limb_t uint64_t #endif +#ifndef PRIxlimb +#define PRIxlimb PRIx64 +#endif + +#ifndef PRIulimb +#define PRIulimb PRIu64 +#endif + #ifndef a24_val #define a24_val 121665 #endif @@ -122,9 +131,9 @@ static void fe_frombytes(limb_t x[modulus_limbs], const uint8_t s[modulus_bytes] static void fe_print(limb_t x[modulus_limbs]) { for (unsigned i=0; i<modulus_limbs-1; i++) { printf("(("); } for (unsigned i=modulus_limbs-1; i > 0; --i) { - printf("0x%016llx)<< %lu) + ", x[i], limb_weight_gaps[i-1]); + printf("0x%016"PRIxlimb")<< %"PRIulimb") + ", x[i], limb_weight_gaps[i-1]); } - printf("0x%016llx", x[0]); + printf("0x%016"PRIxlimb, x[0]); } static void fe_cswap(limb_t bit, limb_t x[modulus_limbs], limb_t y[modulus_limbs]) { |