Bit setting and clearing functions.
[u/mdw/catacomb] / mp.h
diff --git a/mp.h b/mp.h
index c405bca..6ccf523 100644 (file)
--- a/mp.h
+++ b/mp.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: mp.h,v 1.13 2002/10/06 22:52:50 mdw Exp $
+ * $Id: mp.h,v 1.14 2002/10/15 00:19:40 mdw Exp $
  *
  * Simple multiprecision arithmetic
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mp.h,v $
+ * Revision 1.14  2002/10/15 00:19:40  mdw
+ * Bit setting and clearing functions.
+ *
  * Revision 1.13  2002/10/06 22:52:50  mdw
  * Pile of changes for supporting two's complement properly.
  *
@@ -683,23 +686,23 @@ extern mp *mp_lsr2c(mp */*d*/, mp */*a*/, size_t /*n*/);
 /* --- @mp_testbit@ --- *
  *
  * Arguments:  @mp *x@ = a large integer
- *             @size_t n@ = which bit to test
+ *             @unsigned long n@ = which bit to test
  *
  * Returns:    Nonzero if the bit is set, zero if not.
  */
 
-extern int mp_testbit(mp */*x*/, size_t /*n*/);
+extern int mp_testbit(mp */*x*/, unsigned long /*n*/);
 
 /* --- @mp_testbit2c@ --- *
  *
  * Arguments:  @mp *x@ = a large integer
- *             @size_t n@ = which bit to test
+ *             @unsigned long n@ = which bit to test
  *
  * Returns:    Nonzero if the bit is set, zero if not.  Fakes up two's
  *             complement representation.
  */
 
-extern int mp_testbit2c(mp */*x*/, size_t /*n*/);
+extern int mp_testbit2c(mp */*x*/, unsigned long /*n*/);
 
 /* --- @mp_eq@ --- *
  *
@@ -726,6 +729,31 @@ extern int mp_cmp(const mp */*a*/, const mp */*b*/);
 
 #define MP_CMP(a, op, b) (mp_cmp((a), (b)) op 0)
 
+/* --- @mp_setbit@, @mp_clearbit@ --- *
+ *
+ * Arguments:  @mp *d@ = a destination
+ *             @mp *x@ = a large integer
+ *             @unsigned long n@ = which bit to modify
+ *
+ * Returns:    The argument @x@, with the appropriate bit set or cleared.
+ */
+
+extern mp *mp_setbit(mp */*d*/, mp */*x*/, unsigned long /*n*/);
+extern mp *mp_clearbit(mp */*d*/, mp */*x*/, unsigned long /*n*/);
+
+/* --- @mp_setbit2c@, @mp_clearbit2c@ --- *
+ *
+ * Arguments:  @mp *d@ = a destination
+ *             @mp *x@ = a large integer
+ *             @unsigned long n@ = which bit to modify
+ *
+ * Returns:    The argument @x@, with the appropriate bit set or cleared.
+ *             Fakes up two's complement representation.
+ */
+
+extern mp *mp_setbit2c(mp */*d*/, mp */*x*/, unsigned long /*n*/);
+extern mp *mp_clearbit2c(mp */*d*/, mp */*x*/, unsigned long /*n*/);
+
 /* --- @mp_bitop@ --- *
  *
  * Arguments:  @mp *d@ = destination