Usage of Logical AND Bitwise AND
Posted: Fri Apr 20, 2012 2:29 pm
Hi all,
As soon as I start to play with logical and bitwise operators my brain fries and I would like to make sure I dont pick up bad habbits!
I would like to be able to get the logical state ( 0 or 1 ) of a specific bit within a byte, is this the best way;
Result = (Byte AND Mask)&&1
Am I correct in the following assumptions,
Bitwise AND can be implemented in a calculation component using either AND or &
Logical AND is implemented only by using &&
Also I wanted to ensure that I avoided any divide by zero situations, is there a simple technique to use?
Thanks,
John.
As soon as I start to play with logical and bitwise operators my brain fries and I would like to make sure I dont pick up bad habbits!
I would like to be able to get the logical state ( 0 or 1 ) of a specific bit within a byte, is this the best way;
Result = (Byte AND Mask)&&1
Am I correct in the following assumptions,
Bitwise AND can be implemented in a calculation component using either AND or &
Logical AND is implemented only by using &&
Also I wanted to ensure that I avoided any divide by zero situations, is there a simple technique to use?
Thanks,
John.