Two questions key to helping you:

  1. Where are you getting these 80-bit numbers from? (How are you loading them into Perl?)

    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.

  2. If you are loading them in binary (which is the only way) then you will need to know what format they are in.

    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.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Turning very larger numbers into an array of bits by BrowserUk
in thread Turning very larger numbers into an array of bits by gblack

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.