xref: /haiku/src/libs/compat/freebsd_network/compat/machine/atomic.h (revision 5e96d7d537fbec23bad4ae9b4c8e7b02e769f0c6)
1 /*
2  * Copyright 2007, Hugo Santos. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _FBSD_COMPAT_MACHINE_ATOMIC_H_
6 #define _FBSD_COMPAT_MACHINE_ATOMIC_H_
7 
8 
9 #include <KernelExport.h>
10 
11 
12 #define atomic_add_int(ptr, value) \
13 	atomic_add((int32 *)(ptr), value)
14 
15 #define atomic_subtract_int(ptr, value) \
16 	atomic_add((int32 *)(ptr), -value)
17 
18 #define atomic_set_acq_32(ptr, value) \
19 	atomic_set_int(ptr, value)
20 
21 #define atomic_set_int(ptr, value) \
22 	atomic_or((int32 *)(ptr), value)
23 
24 #define atomic_readandclear_int(ptr) \
25 	atomic_set((int32 *)(ptr), 0)
26 
27 #endif	/* _FBSD_COMPAT_MACHINE_ATOMIC_H_ */
28