[sdiy] Quick C query
Tom Wiltshire
tom at electricdruid.net
Sun Nov 21 19:13:56 CET 2010
On 21 Nov 2010, at 18:05, Steff wrote:
> On 21 November 2010 17:45, cheater cheater <cheater00 at gmail.com> wrote:
>>
>>> if(flags == (BLARP | BAR)) { /* do stuff here */ }
>>
>> I think you mean:
>>
>> if(flags & (A | B) == (A | B)) {
>> ...
>> }
I've seen this written as:
if (flags & (A | B)) {
...
}
Which would be the following for a single flag:
if (flags & mask) {
...
}
There's no need for the part with the "==(etc)", since C is just looking for a non-zero result to indicate true (simply processor zero flag clear, I hope).
Or have I got the stick by the sticky end?
T.
More information about the Synth-diy
mailing list