• 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: OSAtomic built-in operations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OSAtomic built-in operations


  • Subject: Re: OSAtomic built-in operations
  • From: Stefan Werner <email@hidden>
  • Date: Sun, 06 May 2012 17:11:17 -0700

On 06.05.2012, at 02:05, Andreas Grosam wrote:

> I would like to use OSAtomicCompareAndSwap32 and OSAtomicOr32Orig using the same variable. Unfortunately, the first requires a signed int, the other an unsigned int.
>
> How can I get this to work?

Have you tried union{} ?

    union {
        int32_t s;
        uint32_t u;
    } atomicvar;
    atomicvar.u = 0;
    OSAtomicCompareAndSwap32(0, 1, &atomicvar.s);
    OSAtomicOr32Orig(0, &atomicvar.u);

-Stefan
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: OSAtomic built-in operations
      • From: Rick Mann <email@hidden>
References: 
 >OSAtomic built-in operations (From: Andreas Grosam <email@hidden>)

  • Prev by Date: Re: Can record ID in iOS address book database change
  • Next by Date: Re: OSAtomic built-in operations
  • Previous by thread: OSAtomic built-in operations
  • Next by thread: Re: OSAtomic built-in operations
  • Index(es):
    • Date
    • Thread