1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-10-21 14:53:53 +03:00

* include/atomic.h: Define catomic_and if not already defined.

* sysdeps/x86_64/bits/atomic.h: Define catomic_and.
	* sysdeps/i386/i486/bits/atomic.h: Likewise.
This commit is contained in:
Ulrich Drepper
2009-02-08 23:50:23 +00:00
parent 6dd6a580df
commit 6c03cd11e9
4 changed files with 64 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
/* Internal macros for atomic operations for GNU C Library.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -415,6 +415,22 @@
} while (0)
#endif
#ifndef catomic_and
# define catomic_and(mem, mask) \
do { \
__typeof (*(mem)) __atg20_old; \
__typeof (mem) __atg20_memp = (mem); \
__typeof (*(mem)) __atg20_mask = (mask); \
\
do \
__atg20_old = (*__atg20_memp); \
while (__builtin_expect \
(catomic_compare_and_exchange_bool_acq (__atg20_memp, \
__atg20_old & __atg20_mask,\
__atg20_old), 0)); \
} while (0)
#endif
/* Atomically *mem &= mask and return the old value of *mem. */
#ifndef atomic_and_val
# define atomic_and_val(mem, mask) \