in reply to Turning very larger numbers into an array of bits
Two questions key to helping you:
This is important as no version of Perl can deal with 80-bit numbers as numbers.
You could however, load them in their binary representation as binary strings of 10 bytes, and then accessing the bits directly is relatively simple.
The only 80-bit numbers in common usage are the extended precision 80-bit IEEE 754 floating point values used internally by the X86 & X64 floating point processors. These have a fairly complicated format and are not directly interpretable bit by bit.
If however, your numbers are simple 80-bit integers stored low bit first, once read from disk or stream, they would be directly interpretable in perl using its bit-wise string operations; or easily converted into an array of bits using unpack. eg:
$bin80bit = "\x01\x23\x45\x67\x89\xab\xcd\xef\xaa\xff";; ## get an 80- +bit binary integer from somewhere. @bits = unpack '(a1)*', unpack 'B*', $bin80bit;; print scalar @bits, ':', "@bits";; 80 : 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 + 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 0 1 +0 1 0 1 0 1 1 1 1 1 1 1 1
(I just do not know of any source of 80-bit integers.)
With answers to those questions, a solution to your question may be possible.
|
|---|