• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Kyle Sluder <email@hidden>
  • Date: Mon, 04 Mar 2013 08:24:20 -0800

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

  • Follow-Ups:
    • Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
      • From: Chris Adamson <email@hidden>
References: 
 >Offline rendering in a AUGraph using a Generic Output node on iOS (From: David Blake <email@hidden>)
 >Re: Offline rendering in a AUGraph using a Generic Output node on iOS (From: Chris Adamson <email@hidden>)
 >Re: Offline rendering in a AUGraph using a Generic Output node on iOS (From: David Blake <email@hidden>)
 >Re: Offline rendering in a AUGraph using a Generic Output node on iOS (From: Chris Adamson <email@hidden>)
 >Re: Offline rendering in a AUGraph using a Generic Output node on iOS (From: David Blake <email@hidden>)
 >mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS) (From: Chris Adamson <email@hidden>)

  • Prev by Date: Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
  • Next by Date: Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
  • Previous by thread: Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
  • Next by thread: Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
  • Index(es):
    • Date
    • Thread