_mp_alloc to long int

Torbjörn Granlund tg at gmplib.org
Sat Jul 30 12:24:10 CEST 2022


Brett Kuntz <kuntz at shaw.ca> writes:

  #include <stdint.h> 
  ... 
  int64_t _mp_alloc; 
  int64_t _mp_size; 

Or plain "long" perhaps as that would only affect 64-bit machines.

  /mpz/realloc.c 
  if (UNLIKELY (new_alloc > ULLONG_MAX / GMP_NUMB_BITS)) 
  if (UNLIKELY (new_alloc > ULLONG_MAX)) 

Plus anaolgous changes to a few more alloc/init functiins.

I wouldn't trust the modified library just if it seems to work with some
application.  I'd modify the test suite to exercise huge operands, that
would give much greater confidence of correctness.

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


More information about the gmp-discuss mailing list