* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
}
/* --- Break out word and bit shifts for more sophisticated work --- */
-
+
nw = n / MPW_BITS;
nb = n % MPW_BITS;
while (avl > av) {
mpw t = *--avl;
- *--dvl = (t >> nr) | w;
+ *--dvl = MPW((t >> nr) | w);
w = t << nb;
}
- *--dvl = w;
+ *--dvl = MPW(w);
MPX_ZERO(dv, dvl);
}
}
/* --- Break out word and bit shifts for more sophisticated work --- */
-
+
nw = n / MPW_BITS;
nb = n % MPW_BITS;
while (avl > av) {
mpw t = *--avl;
- *--dvl = (t >> nr) | w;
+ *--dvl = MPW((t >> nr) | w);
w = t << nb;
}
- *--dvl = (MPW_MAX >> nr) | w;
+ *--dvl = MPW((MPW_MAX >> nr) | w);
MPX_ONE(dv, dvl);
}
a <<= o;
if (dv < dvl) {
- mpd x = (mpd)*dv - (mpd)a;
+ mpd x = (mpd)*dv - MPW(a);
*dv++ = MPW(x);
if (x >> MPW_BITS)
b++;
MPX_SHRINK(bv, bvl);
/* --- Deal with a multiply by zero --- */
-
+
if (bv == bvl) {
MPX_ZERO(dv, dvl);
return;
*/
void mpx_umuln(mpw *dv, mpw *dvl, const mpw *av, const mpw *avl, mpw m)
-{
- MPX_UMULN(dv, dvl, av, avl, m);
-}
+ { MPX_UMULN(dv, dvl, av, avl, m); }
/* --- @mpx_umlan@ --- *
*
*/
void mpx_umlan(mpw *dv, mpw *dvl, const mpw *av, const mpw *avl, mpw m)
-{
- MPX_UMLAN(dv, dvl, av, avl, m);
-}
+ { MPX_UMLAN(dv, dvl, av, avl, m); }
/* --- @mpx_usqr@ --- *
*
unsigned b;
d = dvl[-1];
- for (b = MPW_BITS / 2; b; b >>= 1) {
+ for (b = MPW_P2; b; b >>= 1) {
if (d <= (MPW_MAX >> b)) {
d <<= b;
norm += b;
} while (0)
#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
+
static void dumpbits(const char *msg, const void *pp, size_t sz)
{
const octet *p = pp;
mpx_lsl(d, dl, a, al, n);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** lsl(%i) failed\n", n);
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_lslc(d, dl, a, al, n);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** lslc(%i) failed\n", n);
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_lsr(d, dl, a, al, n);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** lsr(%i) failed\n", n);
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_uadd(d, dl, a, al, b, bl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** uadd failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_usub(d, dl, a, al, b, bl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** usub failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_umul(d, dl, a, al, b, bl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** umul failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_usqr(d, dl, a, al);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** usqr failed\n");
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;