RE: [avr-gcc-list] C coding question

2006-10-10 Thread Eric Weddington
-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

Re: [avr-gcc-list] C coding question

2006-10-09 Thread Paulo Marques
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

Re: [avr-gcc-list] C coding question

2006-10-06 Thread Royce Pereira
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.

[avr-gcc-list] C coding question

2006-10-05 Thread larry barello
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

Re: [avr-gcc-list] C coding question

2006-10-05 Thread Joerg Wunsch
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. --