summaryrefslogtreecommitdiff
path: root/gmp.h
diff options
context:
space:
mode:
authortege <tege@gmplib.org>1999-09-28 17:47:10 +0200
committertege <tege@gmplib.org>1999-09-28 17:47:10 +0200
commitcea59e059c9772a6eaaeebb98b3c102c46108310 (patch)
tree9cab40716e9b5a629d6895d95464faf8d14d1ec5 /gmp.h
parent348a22d6cceac9b9d1a0a37cbe284bfe1adb6553 (diff)
downloadgmp-cea59e059c9772a6eaaeebb98b3c102c46108310.tar.gz
(mpn_incr_u): New macro (from mpn/generic/mul_n.c).
(mpn_decr_u): New macro.
Diffstat (limited to 'gmp.h')
-rw-r--r--gmp.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gmp.h b/gmp.h
index c2f89fab1..646044d2d 100644
--- a/gmp.h
+++ b/gmp.h
@@ -713,6 +713,24 @@ mp_limb_t mpn_submul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
}
#endif
+#define mpn_incr_u(p,incr) \
+ do { mp_limb_t __x; mp_ptr __p = p; \
+ __x = *__p + incr; \
+ *__p = __x; \
+ if (__x < incr) \
+ while (++(*(++__p)) == 0) \
+ ; \
+ } while (0)
+
+#define mpn_decr_u(p,incr) \
+ do { mp_limb_t __x; mp_ptr __p = p; \
+ __x = *__p; \
+ *__p = __x - incr; \
+ if (__x < incr) \
+ while ((*(++__p))-- == 0) \
+ ; \
+ } while (0)
+
#if defined (__GNUC__) || defined (_FORCE_INLINES)
_EXTERN_INLINE mp_limb_t
#if defined (__STDC__) || defined (__cplusplus)