in reply to unpacking 6-bit values

It looks to me like you're reinventing base64 encoding: In base64, 3 bytes are represented as 4 characters, thus, 6 bits per character.

So perhaps building something on top of encoding in MIME::Base64, and converting the characters into bytes using tr, might do.

If bit ordering doesn't mess with you.

Replies are listed 'Best First'.
Re^2: unpacking 6-bit values
by BrowserUk (Patriarch) on Dec 11, 2010 at 06:27 UTC
    It looks to me like you're reinventing base64 encoding:

    No more like the reverse of it. This format compresses four numerical values 0..63 into 3 bytes.

    As you say, in base64, you start with 3 bytes 0..255 and expand them to 4 bytes 65+(0..63). The purpose is to avoid the transmission of control characters that might upset protocols.


    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".
    In the absence of evidence, opinion is indistinguishable from prejudice.