-Original Message-
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
org] On Behalf Of Paulo Marques
Sent: Monday, October 09, 2006 4:39 AM
To: larry barello
Cc: avr-gcc-list@nongnu.org
Subject: Re: [avr-gcc-list] C coding question
larry barello wrote:
[...]
So I said
larry barello wrote:
[...]
So I said:
(bSomeBool?1:0) ^ ((SomeBitMask SomeVariable)?1:0))
Since no one else made this comment, I just wanted to point out that you
can write that as:
(bSomeBool ^ (!!(SomeBitMask SomeVariable)))
!! is often used to convert an integer value into a logical
Hi,
On Fri, 06 Oct 2006 13:39:36 +0530, Nigel Winterbottom [EMAIL PROTECTED]
wrote:
-Original Message-
From: larry barello
Specifically I was looking for an efficient way to encode
(bSomeBool ^ (SomeBitMask SomeVariable))
to get a true/false output.
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
larry barello [EMAIL PROTECTED] wrote:
when mixing bit-wise and logical operations, is it safe to assume
that (!0 == 1) is true?
I think it is, but would have to look it up in the standard.
Use stdbool.h, the type bool, and the values true and false
instead. That's the C99 approach.
--