Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
- Subject: Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
- From: Chris Adamson <email@hidden>
- Date: Mon, 04 Mar 2013 11:30:43 -0500
Not jerky at all… as I was getting in the shower this morning I thought "did I say logical OR when I meant arithmetic?" This is why I need an editor.
So, yeah, what Kyle said: single-pipe and single-ampersand when working with bitfields.
--Chris
On Mar 4, 2013, at 11:24 AM, Kyle Sluder <email@hidden> wrote:
> On Mon, Mar 4, 2013, at 05:53 AM, Chris Adamson wrote:
>> When you logically OR these values together, as the definition of
>> kAudioFormatFlagsCanonical does, the presence of the whichever bit is set
>> gets preserved.
>
> I'm gonna be a pedantic jerk, but only because you've provided a great
> introductory explanation.
>
> The operation you are describing is a _bitwise-OR_, which is represented
> with a single pipe character. A _logical-OR_, represented by two pipe
> characters, does not preserve the bits of both operands. Conceptually,
> it evaluates to true whenever either of its operands is true, but
> because this is C, "true" just means "non-zero numeric value." That
> means the compiler can't help catch when you've used a logical-OR when
> you meant to use a bitwise-OR.
>
> So, when dealing with a bitfield, use bitwise-OR (single |). When
> dealing with boolean values, use logical-OR (double ||).
>
> You can extend the same discussion to the difference between bitwise-AND
> (single &) and logical-AND (double &&).
>
> --Kyle Sluder
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden