diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-06-23 03:25:58 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-06-23 03:25:58 +0200 |
commit | 38390a3bd0de342cc209d7edc484baca785e6547 (patch) | |
tree | b6bc018dbb9ddf726b4f1f8414e70ae2841447ed /gmp-impl.h | |
parent | 98ebd13735774cbbe41bb9949d6e4339d52a1b4a (diff) | |
download | gmp-38390a3bd0de342cc209d7edc484baca785e6547.tar.gz |
* gmp-impl.h (modlimb_invert): Mask after shifting, so mask constant
fits a signed byte.
Diffstat (limited to 'gmp-impl.h')
-rw-r--r-- | gmp-impl.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gmp-impl.h b/gmp-impl.h index 58b1f9fa6..6438019b2 100644 --- a/gmp-impl.h +++ b/gmp-impl.h @@ -1467,7 +1467,7 @@ extern const unsigned char modlimb_invert_table[128]; mp_limb_t __n = (n); \ mp_limb_t __inv; \ ASSERT ((__n & 1) == 1); \ - __inv = modlimb_invert_table[(__n&0xFF)/2]; /* 8 */ \ + __inv = modlimb_invert_table[(__n/2)&0x7F]; /* 8 */ \ ASSERT (__inv * __n == 1); \ (inv) = __inv; \ } while (0) @@ -1478,7 +1478,7 @@ extern const unsigned char modlimb_invert_table[128]; mp_limb_t __n = (n); \ mp_limb_t __inv; \ ASSERT ((__n & 1) == 1); \ - __inv = modlimb_invert_table[(__n&0xFF)/2]; /* 8 */ \ + __inv = modlimb_invert_table[(__n/2)&0x7F]; /* 8 */ \ __inv = 2 * __inv - __inv * __inv * __n; /* 16 */ \ ASSERT (__inv * __n == 1); \ (inv) = __inv; \ @@ -1490,7 +1490,7 @@ extern const unsigned char modlimb_invert_table[128]; mp_limb_t __n = (n); \ mp_limb_t __inv; \ ASSERT ((__n & 1) == 1); \ - __inv = modlimb_invert_table[(__n&0xFF)/2]; /* 8 */ \ + __inv = modlimb_invert_table[(__n/2)&0x7F]; /* 8 */ \ __inv = 2 * __inv - __inv * __inv * __n; /* 16 */ \ __inv = 2 * __inv - __inv * __inv * __n; /* 32 */ \ ASSERT (__inv * __n == 1); \ @@ -1503,7 +1503,7 @@ extern const unsigned char modlimb_invert_table[128]; mp_limb_t __n = (n); \ mp_limb_t __inv; \ ASSERT ((__n & 1) == 1); \ - __inv = modlimb_invert_table[(__n&0xFF)/2]; /* 8 */ \ + __inv = modlimb_invert_table[(__n/2)&0x7F]; /* 8 */ \ __inv = 2 * __inv - __inv * __inv * __n; /* 16 */ \ __inv = 2 * __inv - __inv * __inv * __n; /* 32 */ \ __inv = 2 * __inv - __inv * __inv * __n; /* 64 */ \ |