Nicholas Clark <[EMAIL PROTECTED]> writes: >On Tue, May 24, 2005 at 11:00:35PM +0200, Torsten Schoenfeld wrote: >> Aloha, >> >> is there any way to reliably convert long longs (64bit integers) to SVs >> (and back) on 32bit platforms without losing information, and without >> compiling with -Duse64bitint? Both, IV and NV don't seem to provide >> enough room to store large values. > >Yes, they won't. > >If your conversion is fully managed by you, then you could convert them to >and from strings using the appropriate C functions.
One way to represent them is as a pair of pack-ed longs. This is essentialy done (in your native endian) by long long temp = value; SV * sv = newSVpv((char *) &temp,sizeof(temp)); ... long long retval; retval = *((long long *) SvPV_nolen(sv)); Then with suitable unpack/pack you can get at them with perl. > >If the values have to work in perl space, then I think you'll need to look at >converting them to Math::BigInt objects. Which is more elegant. > >Nicholas Clark