diff options
| author | Tom Tromey <tom@tromey.com> | 2018-08-08 17:01:55 -0600 |
|---|---|---|
| committer | Tom Tromey <tom@tromey.com> | 2018-08-08 17:01:55 -0600 |
| commit | d3549c190152921dd05e694d41e02a002789d191 (patch) | |
| tree | f662e309a5b9419c14a7ef88b8b7312299dda9c6 /src | |
| parent | fb26c9fd69d93aaa789e71365c030083c7f3c775 (diff) | |
Use mpz_import in mpz_set_uintmax_slow
* src/alloc.c (mpz_set_uintmax_slow): Use mpz_import.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c index edfb87e5cdd..1504d7912b3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3874,12 +3874,12 @@ mpz_set_uintmax_slow (mpz_t result, uintmax_t v) { /* If long is larger then a faster path is taken. */ eassert (sizeof (uintmax_t) > sizeof (unsigned long)); - /* This restriction could be lifted if needed. */ - eassert (sizeof (uintmax_t) <= 2 * sizeof (unsigned long)); - mpz_set_ui (result, v >> (CHAR_BIT * sizeof (unsigned long))); - mpz_mul_2exp (result, result, CHAR_BIT * sizeof (unsigned long)); - mpz_add_ui (result, result, v & -1ul); + /* COUNT = 1 means just a single word of the given size. ORDER = -1 + is arbitrary since there's only a single word. ENDIAN = 0 means + use the native endian-ness. NAILS = 0 means use the whole + word. */ + mpz_import (result, 1, -1, sizeof (uintmax_t), 0, 0, &v); } |
