[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggestion For mpz_sizeinbase() Function
From: |
Kevin Ryde |
Subject: |
Re: Suggestion For mpz_sizeinbase() Function |
Date: |
17 Jul 2001 11:20:34 +1000 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.5 |
"David T. Ashley" <address@hidden> writes:
> It depends on the assumptions about the platforms. Can they all divide
> integers? And the least capable platform--what sizes of integers can it
> divide?
Alas division as such is usually slow, and sometimes doesn't exist at
all natively (alpha, itanium).
A multiply-by-inverse is often best if an inverse can be
pre-calculated (as in this case), or will be used a few times. It
ends up roughly equivalent to 2 muls, and finds good use in
mpn_divrem_1 in particular. See "Division by Invariant Integers"
paper in the references in the manual, and udiv_qrnnd_preinv in
gmp-impl.h.