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

RE: RFC: pack()ing long words

Thread Previous | Thread Next
From:
bulk 88
Date:
August 15, 2012 01:01
Subject:
RE: RFC: pack()ing long words
Message ID:
COL115-W18E1C680AF6DFC160AD0CCDFB60@phx.gbl



----------------------------------------
> Date: Tue, 14 Aug 2012 18:10:02 +0100
> From: david@cantrell.org.uk
> To: perl5-porters@perl.org
> 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 http://search.cpan.org/~salva/Math-Int64-0.26/lib/Math/Int64.pm 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About