Commit 71e3024f30ed8d1696461e20070a77683e4437e4

Kevin B Kenny 2005-05-10T17:20:39

fix mp_iseven

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/tommath.h b/tommath.h
index 7dda0a5..80bae69 100644
--- a/tommath.h
+++ b/tommath.h
@@ -203,7 +203,7 @@ int mp_init_size(mp_int *a, int size);
 
 /* ---> Basic Manipulations <--- */
 #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
-#define mp_iseven(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO)
+#define mp_iseven(a) ((((a)->used == 0) || (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO)
 #define mp_isodd(a)  ((((a)->used > 0) && (((a)->dp[0] & 1u) == 1u)) ? MP_YES : MP_NO)
 #define mp_isneg(a)  (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO)