Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Bitwise question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Willem, post: 3971372"] Seebs wrote: )> I'm wondering if I want to check if a bit is not set, )> the following statements are valid: ) )> /* check if bit is not set */ )> if ( !(MASK & BIT_TO_CHECK) ) )> { )> /* do something */ )> } ) ) This is. ) )> /* check if bit is not set */ )> if ( MASK & ~BIT_TO_CHECK ) )> { )> /* do something */ )> } ) ) No. This checks whether any other bits are set, which is not the same ) question. You can fix it though, by moving the ~ to a different location. SaSW, Willem -- Disclaimer: I am in no way responsible for any of the statements made in the above text. For all I know I might be drugged or something.. No I'm not paranoid. You all think I'm paranoid, don't you ! #EOT [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Bitwise question
Top