math/mp-gcd.c: Avoid clobbering constants during the sign fixup.
[catacomb] / math / mp-gcd.c
index 6e059e3..c36689c 100644 (file)
@@ -199,10 +199,8 @@ void mp_gcd(mp **gcd, mp **xx, mp **yy, mp *a, mp *b)
 
     /* --- Twiddle the signs --- */
 
-    if (f & f_aneg)
-      x->f ^= MP_NEG;
-    if (f & f_bneg)
-      y->f ^= MP_NEG;
+    if (f & f_aneg) { MP_SPLIT(x); x->f ^= MP_NEG; }
+    if (f & f_bneg) { MP_SPLIT(y); y->f ^= MP_NEG; }
 
     /* --- Store the results --- */