progs/perftest.c: Use from Glibc syscall numbers.
[catacomb] / math / f25519.c
index a886465..a0f40fa 100644 (file)
@@ -183,18 +183,18 @@ void f25519_load(f25519 *z, const octet xv[32])
    * and lower bounds are achievable.
    *
    * All of the x_i at this point are positive, so we don't need to do
-   * anything wierd when masking them.
+   * anything weird when masking them.
    */
-  b = x9&B24; c   = 19&((b >> 19) - (b >> 24)); x9 -= b << 1;
-  b = x8&B25; x9 +=      b >> 25;              x8 -= b << 1;
-  b = x7&B24; x8 +=     b >> 24;               x7 -= b << 1;
-  b = x6&B25; x7 +=     b >> 25;               x6 -= b << 1;
-  b = x5&B24; x6 +=     b >> 24;               x5 -= b << 1;
-  b = x4&B25; x5 +=     b >> 25;               x4 -= b << 1;
-  b = x3&B24; x4 +=     b >> 24;               x3 -= b << 1;
-  b = x2&B25; x3 +=     b >> 25;               x2 -= b << 1;
-  b = x1&B24; x2 +=     b >> 24;               x1 -= b << 1;
-  b = x0&B25; x1 +=     (b >> 25) + (x0 >> 26); x0 = (x0&M26) - (b << 1);
+  b = x9&B24; c   = 19&((b >> 19) - (b >> 24)); x9 -=            b << 1;
+  b = x8&B25; x9 +=     b >> 25;               x8 -=             b << 1;
+  b = x7&B24; x8 +=     b >> 24;               x7 -=             b << 1;
+  b = x6&B25; x7 +=     b >> 25;               x6 -=             b << 1;
+  b = x5&B24; x6 +=     b >> 24;               x5 -=             b << 1;
+  b = x4&B25; x5 +=     b >> 25;               x4 -=             b << 1;
+  b = x3&B24; x4 +=     b >> 24;               x3 -=             b << 1;
+  b = x2&B25; x3 +=     b >> 25;               x2 -=             b << 1;
+  b = x1&B24; x2 +=     b >> 24;               x1 -=             b << 1;
+  b = x0&B25; x1 +=     (b >> 25) + (x0 >> 26); x0  = (x0&M26) - (b << 1);
              x0 +=      c;
 
   /* And with that, we're done. */
@@ -756,7 +756,7 @@ static void carry_reduce(dblpiece x[NPIECE])
    * signed.
    */
 
-  /*For each piece, we bias it so that floor division (as done by an
+  /* For each piece, we bias it so that floor division (as done by an
    * arithmetic right shift) and modulus (as done by bitwise-AND) does the
    * right thing.
    */
@@ -1178,6 +1178,7 @@ int f25519_quosqrt(f25519 *z, const f25519 *x, const f25519 *y)
 
 #ifdef TEST_RIG
 
+#include <mLib/macros.h>
 #include <mLib/report.h>
 #include <mLib/str.h>
 #include <mLib/testrig.h>
@@ -1218,7 +1219,7 @@ static void dump_f25519_ref(dstr *d, FILE *fp)
 }
 
 static int eq(const f25519 *x, dstr *d)
-  { octet b[32]; f25519_store(b, x); return (memcmp(b, d->buf, 32) == 0); }
+  { octet b[32]; f25519_store(b, x); return (MEMCMP(b, ==, d->buf, 32)); }
 
 static const test_type
   type_f25519 = { cvt_f25519, dump_f25519 },