Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Extracting Bit Fields (Again)

by ikegami (Patriarch)
on Oct 12, 2005 at 03:53 UTC ( [id://499359]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $D1 = ($num >> 7) & 0x01;  # 1 bit  starting at bit 7.
    $D2 = ($num >> 4) & 0x07;  # 3 bits starting at bit 4.
    $D3 = ($num >> 0) & 0x0F;  # 4 bits starting at bit 0.
    
  2. or download this
    @D = map { unpack('C', pack('b*', $_)) } unpack('b1b3b4', 162);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://499359]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-25 12:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found