]> git.codecow.com Git - Monocypher.git/commitdiff
Fixed Clang warnings
authorLoup Vaillant <loup@loup-vaillant.fr>
Tue, 19 Nov 2019 23:05:26 +0000 (00:05 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Tue, 19 Nov 2019 23:05:26 +0000 (00:05 +0100)
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

index 5855ec09f42d10b232a952ef6e5f4d57017a32e6..a3c7656ad674b8fbbeeeba37237d71f33ccb5fa3 100644 (file)
@@ -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;