Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How can I set a bit to 0 ?

by ikegami (Patriarch)
on May 26, 2022 at 16:37 UTC ( [id://11144201]=note: print w/replies, xml ) Need Help??


in reply to How can I set a bit to 0 ?

Set:

$flags |= 1 << $bit_num;

Clear:

$flags &= ~( 1 << $bit_num );

Toggle:

$flags ^= 1 << $bit_num;

Read (returns a true value or a false value):

$flags & ( 1 << $bit_num )

It looks like you have constants that are already of the form 1 << $bit_num, so

$stats &= ~downLoading; # No longer downloading.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-25 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found