Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Extracting Bit Fields (Again)

by ozboomer (Friar)
on Oct 12, 2005 at 05:29 UTC ( [id://499381]=note: print w/replies, xml ) Need Help??


in reply to Re: Extracting Bit Fields (Again)
in thread Extracting Bit Fields (Again)

There is a rotate... I'd just forgotten about it... and this way is the simplest and clearest for what I need to do:-
$D1 = ($intbuf & 0x80) ? 1 : 0; $D2 = ($intbuf >> 4) & 0x07; $D3 = ($intbuf & 0x0F);
My fogged brain can now keep struggling away at this job...

Many, many thanks for all your help, folks.

Replies are listed 'Best First'.
Re^3: Extracting Bit Fields (Again)
by ikegami (Patriarch) on Oct 12, 2005 at 14:17 UTC
    There is a rotate...
    huh? no Or are you talking about some module?
      Sorry about that... my slack use of the language(!)

      I mean a 'right shift operator' (the '>>'). Sometimes I revert to assembler or C -style constructs/language and I use the terms interchangably... but it's really just 'rotating the bits (right)' that I was trying to remember.

        C doesn't have a rotate operator either.

        The rotate operator takes the bits that are shifted out of the register and shifts then in from the other end.

        Rotate 010...101 by 1 to to the right = 1010...10
        Shift 010...101 by 1 to to the right = 0010...10

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-03-29 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found