All,
A quick question for the group. I am using a byte as 8 booleans and in some of my "IF" statements, I am reading certain bits to be "true" per the example below.
In the instance where you would want to check if the bit boolean is false condition, would you write as such...
or would the code below have to be substituted...
I am currently not at a computer to test this so, please forgive that aspect.
Thanks
Bryan
A quick question for the group. I am using a byte as 8 booleans and in some of my "IF" statements, I am reading certain bits to be "true" per the example below.
Code:
if(bit_bool & (1<<0)) {do_something();}
In the instance where you would want to check if the bit boolean is false condition, would you write as such...
Code:
if(!(bit_bool & (1<<0))) {do_nothing();}
or would the code below have to be substituted...
Code:
if(bit_bool & (1<<0) != true) {do_nothing();}
I am currently not at a computer to test this so, please forgive that aspect.
Thanks
Bryan