Search Results

Search: Posts Made By: jim mcnamara
Forum: Programming 03-21-2008
6,538
Posted By jim mcnamara
The OP pm'ed me. I think it may be a translation...
The OP pm'ed me. I think it may be a translation problem. He wants to see which bit is set 0 - 31 or ( 1 - 32). Anyway, that is my take on it.

CHAR_BIT is 8 per C99 standard.
Forum: Programming 03-21-2008
6,538
Posted By jim mcnamara
if you want to see which bit is set: ...
if you want to see which bit is set:


if(value & 1 ) -> true if first bit is set
if(value & 2 ) second bit
if(value & 4) third
if(value & 8) fourth
if(value & 16) fifth
... and so on
Forum: Programming 03-21-2008
6,538
Posted By jim mcnamara
Your answer still was not clear. I think you...
Your answer still was not clear. I think you want this:

x = x ^ mask;
(or x ^= mask;)
Bits that are set to 1 in the mask will be flipped in x.
Bits that are set to 0 in the mask will be...
Forum: Programming 03-21-2008
6,538
Posted By jim mcnamara
Kinda vague - do you want to turn the bit on? ...
Kinda vague - do you want to turn the bit on? off? flip the bit?
Showing results 1 to 4 of 4

 
All times are GMT -4. The time now is 02:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy