--- /n/sources/plan9/sys/src/libmp/port/mpvecadd.c Sat Jan 10 10:00:05 2015 +++ /sys/src/libmp/port/mpvecadd.c Sun Jun 28 00:00:00 2026 @@ -14,21 +14,14 @@ mpvecadd(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *sum) x = *a++; y = *b++; x += carry; - if(x < carry) - carry = 1; - else - carry = 0; + carry = x < carry; x += y; - if(x < y) - carry++; + carry += x < y; *sum++ = x; } for(; i < alen; i++){ x = *a++ + carry; - if(x < carry) - carry = 1; - else - carry = 0; + carry = x < carry; *sum++ = x; } *sum = carry; --- /n/sources/plan9/sys/src/libmp/port/mpvecdigmuladd.c Sat Jan 10 10:00:05 2015 +++ /sys/src/libmp/port/mpvecdigmuladd.c Sun Jun 28 00:00:00 2026 @@ -2,7 +2,7 @@ #include #include "dat.h" -#define LO(x) ((x) & ((1<<(Dbits/2))-1)) +#define LO(x) ((x) & ((1ll<<(Dbits/2))-1)) #define HI(x) ((x) >> (Dbits/2)) static void @@ -24,15 +24,12 @@ mpdigmul(mpdigit a, mpdigit b, mpdigit *p) p4 = ah*bh; // p = ((p1+p2)<<(Dbits/2)) + (p4< x) - borrow = 1; - else - borrow = 0; + borrow = y > x; x = part[1]; mpdigmul(*b++, m, part); x += part[0]; - if(x < part[0]) - borrow++; + borrow += x < part[0]; x = y - x; - if(x > y) - borrow++; + borrow += x > y; *p++ = x; } --- /n/sources/plan9/sys/src/libmp/port/mpvecsub.c Sat Jan 10 10:00:05 2015 +++ /sys/src/libmp/port/mpvecsub.c Sun Jun 28 00:00:00 2026 @@ -14,21 +14,14 @@ mpvecsub(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *diff) x = *a++; y = *b++; y += borrow; - if(y < borrow) - borrow = 1; - else - borrow = 0; - if(x < y) - borrow++; + borrow = y < borrow; + borrow += x < y; *diff++ = x - y; } for(; i < alen; i++){ x = *a++; y = x - borrow; - if(y > x) - borrow = 1; - else - borrow = 0; + borrow = y > x; *diff++ = y; } }