I was off the grid for a few days.
Let me say a couple of things.
First, I think a quick fix to the problem at hand is to replace
static_cast<long*> to (long*) at lines 507 and 509 of NTLconvert.cc.
I didn't really change that much, the void* type got changed to a different
pointer type that helped catch some bugs in the modifications I made
Second, I will update NTL soon to provide better "low level" conversion routines.
I have been hesitant to do this previously, because in general, NTL header files
do not include <gmp.h>, and I prefer to keep things that way, for a variety
However, one needs <gmp.h> just to get the mp_limb_t typedef.
But what I will do is make a special header file just for these conversion
routines, which will include <gmp.h> (assuming NTL_GMP_LIP=on).
This will require that client code using this header needs to make sure
that the environment is set up to find <gmp.h>.
The signature for these functions will be something like
void ZZRawConvertFrom(const ZZ& x, zzigit_t *p);
// writes the x.size() zzigits of x to location p, starting with the low-order zzigit
void ZZRawConvertTo(ZZ& x, const zzigit_t *p, long n);
// initialize x with p[0..n-1], where p is the low-oder zzigit
Here, zzigit_t will be a typedef to mp_limb_t (if NTL_GMP_LIP=on)
or to unsigned long (if NTL_GMP_LIP=off).
I'll also define a macro NTL_BITS_PER_ZZIGIT_T (which may
be less than NTL_ZZ_NBITS).
Granted, mp_limb_t is usually set to unsigned long, but I guess this is
not always the case for some platforms. Also, this interface will work
even if NTL is not built with GMP.