Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Help comparing data in byte by shifting (>>) bits

by japhy (Canon)
on Jun 15, 2006 at 17:11 UTC ( [id://555563]=note: print w/replies, xml ) Need Help??


in reply to Help comparing data in byte by shifting (>>) bits

I think you want if (($a >> $b) & 1) { ... }. That checks to see if the $b'th bit (from the right) is on.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-16 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found