498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
|
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
int r;
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"jne .1\n\t"
"incl %0\n"
".1:"
: "=&r"(r)
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
|
|
|
|
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
|
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
int r;
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"jne 0\n\t"
"incl %0\n"
"0:"
: "=&r"(r)
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
|
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
|
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
int r;
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"jne .1\n\t"
"incl %0\n"
".1:"
: "=&r"(r)
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
|
|
|
|
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
|
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
int r;
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"jne 0\n\t"
"incl %0\n"
"0:"
: "=&r"(r)
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
|
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
|
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
int r;
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"jne .1\n\t"
"incl %0\n"
".1:"
: "=&r"(r)
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
return OSAtomicCompareAndSwapPtrBarrier(o, n, p);
#endif
}
|
|
|
|
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
|
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
int r;
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"jne 0\n\t"
"incl %0\n"
"0:"
: "=&r"(r)
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
return OSAtomicCompareAndSwapPtrBarrier(o, n, p);
#endif
}
|