On Wed, Apr 09, 2003 at 05:46:03AM +0900, Philip Mak wrote:
> Is there a way to pack() a signed long in a portable fashion (i.e. it
> should work on both little endian and big endian machines)?
> 
> The pack() function has these options:
> 	'l' => { :signed => true, :network => false }
> 	'N' => { :signed => false, :network => true }
> 
> But I cannot find an option that is { :signed => true, :network => true }!
> 
> So if I pack with 'l', it won't work on different architectures. And
> if I pack with 'N', it won't allow negative numbers.
> 
> For now, I think I have to pack with 'N', but add 2**32 before packing
> and subtract 2**32 after unpacking, but I think there ought to be a
> better way?

Won't this transform the number into a Bignum?
Believe it's 2**31 (remember Fixnum's length), but am not really sure...

-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

lp1 on fire
	-- One of the more obfuscated kernel messages