[HarfBuzz] harfbuzz: Branch 'master'

Jiang Jiang gzjjgod at gmail.com
Mon Dec 10 07:14:45 PST 2012


On Mon, Dec 10, 2012 at 6:58 AM, Behdad Esfahbod
<behdad at kemper.freedesktop.org> wrote:
> commit 071d5b831e6de5f3b24160dc77b139cb040ab886
> Author: Behdad Esfahbod <behdad at behdad.org>
> Date:   Mon Dec 10 00:57:00 2012 -0500
>
>     Work around missing OSAtomicCompareAndSwapPtrBarrier() on OS X 10.4
>
>     Not sure how to handle iOS.

There is <Availability.h> available on OS X 10.6 and iOS for checking
__IPHONE_OS_VERSION_MAX_ALLOWED and so on.

>
> diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
> index 5861a71..a4d6cbe 100644
> --- a/src/hb-atomic-private.hh
> +++ b/src/hb-atomic-private.hh
> @@ -69,12 +69,23 @@ typedef long hb_atomic_int_t;
>  #elif !defined(HB_NO_MT) && defined(__APPLE__)
>
>  #include <libkern/OSAtomic.h>
> +#include <AvailabilityMacros.h>
>
>  typedef int32_t hb_atomic_int_t;
>  #define hb_atomic_int_add(AI, V)       (OSAtomicAdd32Barrier ((V), &(AI)) - (V))
>
>  #define hb_atomic_ptr_get(P)           (OSMemoryBarrier (), (void *) *(P))
> +#if (MAX_OS_X_VERSION_MAX_ALLOWED >= MAX_OS_X_VERSION_10_5)
> +/* XXX We should expand the above check to also allow iPhone OS >= 2.0, but I can't find any info re
> + * AvailabilityMacros.h for iOS.  Is it even available there? */
>  #define hb_atomic_ptr_cmpexch(P,O,N)   OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
> +#else
> +#if __ppc64__ || __x86_64__
> +#define hb_atomic_ptr_cmpexch(P,O,N)    OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t*) (P))
> +#else
> +#define hb_atomic_ptr_cmpexch(P,O,N)    OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t*) (P))
> +#endif
> +#endif
>
>
>  #elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/harfbuzz



More information about the HarfBuzz mailing list