Small limb-size in mini-gmp?

Torbjörn Granlund tg at gmplib.org
Wed Nov 20 16:08:02 UTC 2019


Marco Bodrato <bodrato at mail.dm.unipi.it> writes:

  I was thinking also to some embedded systems I used some years ago,
  where "unsigned long" was supported by the compiler, but slow on the
  hardware...

  But currently also those embedded systems are probably obsolete.

Not obsolete at all!  I program a 80251 at work, where 8-bit and 16-bit
plain arithmetic take a single cycle, while 32-bit ops need two cycles.
(But I don't intend to run GMP on that hardware.)

  Ok. We can decide to keep a single variant for mpn_invert_3by2.
  Will changing the type currently used for "half limbs", taking care of
  negations and carry detection... be enough? We should try.

With asl.h intermediates will get truncated to the size of mp_limb_t.
With (unsigned) char or (unsigned) short intermediates will have the
type (unsigned) int.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list