math/mp-arith.c (mp_testbit): Want nonstrict comparison for bounds check.
[catacomb] / math / mp-arith.c
index 2d7d635..61780b0 100644 (file)
@@ -116,7 +116,7 @@ mp *mp_lsr2c(mp *d, mp *a, size_t n)
 
 int mp_testbit(mp *x, unsigned long n)
 {
-  if (n > MPW_BITS * MP_LEN(x))
+  if (n >= MPW_BITS * MP_LEN(x))
     return (0);
   return ((x->v[n/MPW_BITS] >> n%MPW_BITS) & 1u);
 }