when mixing bit-wise and logical operations, is it safe to assume that (!0 == 1) is true?
Specifically I was looking for an efficient way to encode (bSomeBool ^ (SomeBitMask & SomeVariable)) to get a true/false output. Of course, expressed, as above, doesn't work too well when bit-wise exclusive or-ing the bool with the bitmask. So I said: (bSomeBool?1:0) ^ ((SomeBitMask & SomeVariable)?1:0)) which worked fine, but isn't particularly efficient in assembly. Not that I really care, but since I had to look at it to realize my mistake, I became interested in a better way to express the thought. For example, is the following guaranteed to work? (bSomeBool ^ ((SomeBitMask & SomeVariable)?1:0)) Where bSomeBool is either 0 or !0? Cheers! _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list