develooper Front page | perl.perl5.porters | Postings from August 2012

RE: RFC: pack()ing long words

Thread Previous | Thread Next
bulk 88
August 15, 2012 01:01
RE: RFC: pack()ing long words
Message ID:

> Date: Tue, 14 Aug 2012 18:10:02 +0100
> From:
> To:
> Subject: Re: RFC: pack()ing long words
> On Mon, Aug 13, 2012 at 07:18:42PM -0500, Craig A. Berry wrote:
> > pp_pack.c has its terrors, but even I can see that if you unpack an
> > integer type you get an IV or a UV on the stack (that's what mPUSHi
> > and mPUSHu do). What is it you want pushed on the stack when you
> > unpack a 16-byte word?
> Dunno. I guess the thing that is the closest match to an int would be a
> string of bytes in the right order, so a PV.
A packed stringĀ  (PV, binary gibberish, not ASCII numbers) is the best, or others say method of last resort to pack/unward any word size ints. If a sufficient big number library is loaded into the script, then return/take big number objects. I integrated into my XS library, so Math::Int64 objects are accepted and returned, or 8byte PV strings otherwise. Size is checked to make sure the scalar is exactly 8 characters long for sanity reasons.
Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About