From 10ecfb8d97b80328c913dc00964f6ad288d5c83f Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Wed, 20 Nov 2019 00:05:26 +0100 Subject: [PATCH] Fixed Clang warnings Reverts 0073a9c8941a0e04a10035e7cc00ffddc8c0f083 Turns out the C99 standard guarantees a 2's complement representation for fixed width integers: section 7.20.1.1, paragraph 1: > The typedef name intN_t designates a signed integer type with width N, > no padding bits, and a two's complement representation. The comment was not needed though (those line are fully portable C99), so I preserved its removal. --- src/monocypher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/monocypher.c b/src/monocypher.c index 5855ec0..a3c7656 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -1029,7 +1029,7 @@ static void fe_sub (fe h,const fe f,const fe g){FOR(i,0,10) h[i] = f[i] - g[i];} static void fe_cswap(fe f, fe g, int b) { - u32 mask = -b; // -1 = 0xffffffff + i32 mask = -b; // -1 = 0xffffffff FOR (i, 0, 10) { i32 x = (f[i] ^ g[i]) & mask; f[i] = f[i] ^ x; @@ -1039,7 +1039,7 @@ static void fe_cswap(fe f, fe g, int b) static void fe_ccopy(fe f, const fe g, int b) { - u32 mask = -b; // -1 = 0xffffffff + i32 mask = -b; // -1 = 0xffffffff FOR (i, 0, 10) { i32 x = (f[i] ^ g[i]) & mask; f[i] = f[i] ^ x; -- 2.47.3