/* -*-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
*
/*----- 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.
*
/* --- @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@ --- *
*
#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