diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2021-10-01 22:39:11 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2021-10-01 22:39:11 +0200 |
commit | 5ad4764361ee56868db1bb0b8ebb5bafdc9be6dc (patch) | |
tree | 7831835b50c1154505d9c867a04e9d7193dd29b4 /mini-gmp | |
parent | 1ff229a75b10f8f1cec24ca8e7e5e4dede1c2cd2 (diff) | |
download | gmp-5ad4764361ee56868db1bb0b8ebb5bafdc9be6dc.tar.gz |
mini-gmp/mini-gmp.c: Add asserts (removed at compile time) on limb size.
Diffstat (limited to 'mini-gmp')
-rw-r--r-- | mini-gmp/mini-gmp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mini-gmp/mini-gmp.c b/mini-gmp/mini-gmp.c index a61ebf312..8577b59ef 100644 --- a/mini-gmp/mini-gmp.c +++ b/mini-gmp/mini-gmp.c @@ -148,6 +148,7 @@ see https://www.gnu.org/licenses/. */ mp_limb_t __x0, __x1, __x2, __x3; \ unsigned __ul, __vl, __uh, __vh; \ mp_limb_t __u = (u), __v = (v); \ + assert (sizeof (unsigned) * 2 >= sizeof (mp_limb_t)); \ \ __ul = __u & GMP_LLIMB_MASK; \ __uh = __u >> (GMP_LIMB_BITS / 2); \ @@ -783,6 +784,7 @@ mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0) mp_limb_t p, ql; unsigned ul, uh, qh; + assert (sizeof (unsigned) * 2 >= sizeof (mp_limb_t)); /* For notation, let b denote the half-limb base, so that B = b^2. Split u1 = b uh + ul. */ ul = u1 & GMP_LLIMB_MASK; |