ObjFW  Diff

Differences From Artifact [e354f89407]:

To Artifact [a4f95ba0da]:


652
653
654
655
656
657
658
659

660
661
662
663
664
665

666
667
668

669
670
671
672
673
674
675
652
653
654
655
656
657
658

659
660
661
662
663
664

665
666
667

668
669
670
671
672
673
674
675







-
+





-
+


-
+







#elif defined(OF_HAVE_OSATOMIC)
	return OSAtomicXor32Barrier(i, p);
#else
# error No atomic operations available!
#endif
}

static OF_INLINE BOOL
static OF_INLINE bool
of_atomic_cmpswap_int(volatile int *p, int o, int n)
{
#if !defined(OF_HAVE_THREADS)
	if (*p == o) {
		*p = n;
		return YES;
		return true;
	}

	return NO;
	return false;
#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"
686
687
688
689
690
691
692
693

694
695
696
697
698
699

700
701
702

703
704
705
706
707
708
709
686
687
688
689
690
691
692

693
694
695
696
697
698

699
700
701

702
703
704
705
706
707
708
709







-
+





-
+


-
+







#elif defined(OF_HAVE_OSATOMIC)
	return OSAtomicCompareAndSwapIntBarrier(o, n, p);
#else
# error No atomic operations available!
#endif
}

static OF_INLINE BOOL
static OF_INLINE bool
of_atomic_cmpswap_32(volatile int32_t *p, int32_t o, int32_t n)
{
#if !defined(OF_HAVE_THREADS)
	if (*p == o) {
		*p = n;
		return YES;
		return true;
	}

	return NO;
	return false;
#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"
720
721
722
723
724
725
726
727

728
729
730
731
732
733

734
735
736

737
738
739
740
741
742
743
720
721
722
723
724
725
726

727
728
729
730
731
732

733
734
735

736
737
738
739
740
741
742
743







-
+





-
+


-
+







#elif defined(OF_HAVE_OSATOMIC)
	return OSAtomicCompareAndSwap32Barrier(o, n, p);
#else
# error No atomic operations available!
#endif
}

static OF_INLINE BOOL
static OF_INLINE bool
of_atomic_cmpswap_ptr(void* volatile *p, void *o, void *n)
{
#if !defined(OF_HAVE_THREADS)
	if (*p == o) {
		*p = n;
		return YES;
		return true;
	}

	return NO;
	return false;
#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"