[ntl] NTL RR class and long long integer

Victor Shoup shoup at cs.nyu.edu
Thu Jul 9 16:32:14 CDT 2015


The only real solution is to install a linux distribution
on your machine.  Then long will be 64 bits (as it is everywhere
but on Windoze)...all your problems will go away, and your code
will run much faster, especially if you also use GMP (which is
much easier to use on Linux, I think).

Still, it's a valid question.
First, __int64 is a nonstandard type, so it seems unlikely
that I'll add a conversion for that any time.
Second, long long is actually relatively new to standard C++.
It would be reasonable to add a conversion there.

If you really need to do it on Windoze, and runtime is 
a concern, the fastest way to do it will be to use
the ToBytes and FromBytes routines, and then pack/unpack
the bytes to/from __int64 (or even just exploit the endianness 
thing, if that works and is acceptable for you).

On Jul 9, 2015, at 5:14 PM, Friedrich Wiemer wrote:

> Hi Luigi, 
> 
> did you try to convert RR to ZZ and then to int64?
> ZZ is NTLs multiprecision integer type, while RR is for multiprecision floats. 
> 
> Cheers, Friedrich
> 
> On July 9, 2015 11:08:08 PM CEST, Luigi Candurro <luigicandurro at virgilio.it> wrote:
> Hi all,
> 
> I have got i touch with NTL (WinNTL-9_2_0) few days ago, I have 
> successfully installed it
> (on Windows 7 64-bit and Visual C++ 2008) and now I am doing some testing.
> 
> I have found that conversion operator conv<T> allows to convert between 
> RR class and some C integer types (int, long int and their unsigned 
> versions), but does not cover the 64-bit integer type __int64 or long 
> long and its unsigned version. I have made the conversion functions I 
> need from RR to __int64 and unsigned __int64, but I had to convert RR 
> into string, and string into 64-bit integer, very annoying and unefficient.
> 
> Is there a way to add conversion between RR and 64-bit (long long) integer?
> 
> Bye
> 
> Luigi
> 
> 
> ntl mailing list
> ntl at shoup.net
> http://shoup.net/mailman/listinfo/ntl_shoup.net
> 
> -- 
> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
> _______________________________________________
> ntl mailing list
> ntl at shoup.net
> http://shoup.net/mailman/listinfo/ntl_shoup.net




More information about the ntl mailing list