aboutsummaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/math')
-rw-r--r--src/math/bigint/mp_amd64/mp_asmi.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/math/bigint/mp_amd64/mp_asmi.h b/src/math/bigint/mp_amd64/mp_asmi.h
index 16632a38d..bf3469526 100644
--- a/src/math/bigint/mp_amd64/mp_asmi.h
+++ b/src/math/bigint/mp_amd64/mp_asmi.h
@@ -68,12 +68,20 @@ extern "C" {
*************************************************/
inline word word_add(word x, word y, word* carry)
{
+#if 0
asm(
ADD_OR_SUBTRACT(ASM("adcq %[y],%[x]"))
: [x]"=r"(x), [carry]"=r"(*carry)
: "0"(x), [y]"rm"(y), "1"(*carry)
: "cc");
return x;
+#else
+ word z = x + y;
+ word c1 = (z < x);
+ z += *carry;
+ *carry = c1 | (z < *carry);
+ return z;
+#endif
}
/*************************************************