I'm sure this has been discussed before and maybe there are good reasons
why its not in there (or I've really missed something) already but I'd
like to see a simple and fast way to unpack/pack bignums out to/into
"raw" string data.
Ok, you can currently do along the lines of
def pack_int(integer)
["%x" % integer].pack("H*")
end
def unpack_int(str)
str.unpack("H*").first.hex
end
but its conceptually messy imho and slower than it could be. Also since we
can now pack quad's ie. numbers that have a binary representation that
fits in 8 bytes I see no reason why we shouldn't go all the way.
Comments/Ideas/Critique?
Regards,
Robert Feldt