What I mean is that if you have b,c,d,e,f,... each corrensponding to only one bit set, for instance:
b=0x00000001;// bit 0 set
c=0x00000002;// bit 1 set
d=0x00000004;// bit 2 set
e=0x00000008;// bit 3 set
f=0x00000010;// bit 4 set
then a condition using (a & b) evaluates to true (non-zero) only if a has the bit 0 set and the same holds for a condition using ((a & b) == b). In the same way, a condition using (a & c) evaluates to non-zero only if a has the bit 1 set, the same holding for a condition using ((a & c)==c), and so on... On the other hand, suppose that x is a combination (sum using OR) of the above indipendent values, for instance x= b | e;, so that x=0x00000009, i.e. x has both the bits 0 and 3 set. In this case, a condition using (a & x) evaluates to non-zero either if a has:* only bit 0 set
only bit 3 set
both bit 0 and 3while a condition using ((a & x) == x) holds true only if both bit 0 and 3 are set. In other words, if x = 0x00000009; then (a & x) holds true if a = 0x00000001;, or a = 0x00000008;, or a = 0x00000009; while ((a & x) == x) holds true if a = 0x00000009. hope that helps :) BTW both conditions are also true if a = 0x00000019 and so on...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.