2 * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * Inclusion of this file signifies that AO_t is in fact int. Hence
25 * any AO_... operations can also server as AO_int_... operations.
26 * We currently define only the more important ones here, and allow for
27 * the normal generalization process to define the others.
28 * We should probably add others in the future.
31 #if defined(AO_HAVE_compare_and_swap_full) && \
32 !defined(AO_HAVE_int_compare_and_swap_full)
33 # define AO_int_compare_and_swap_full(addr, old, new_val) \
34 AO_compare_and_swap_full((volatile AO_t *)addr, \
35 (AO_t) old, (AO_t)new_val)
36 # define AO_HAVE_int_compare_and_swap_full
39 #if defined(AO_HAVE_compare_and_swap_acquire) && \
40 !defined(AO_HAVE_int_compare_and_swap_acquire)
41 # define AO_int_compare_and_swap_acquire(addr, old, new_val) \
42 AO_compare_and_swap_acquire((volatile AO_t *)addr, \
43 (AO_t) old, (AO_t)new_val)
44 # define AO_HAVE_int_compare_and_swap_acquire
47 #if defined(AO_HAVE_compare_and_swap_release) && \
48 !defined(AO_HAVE_int_compare_and_swap_release)
49 # define AO_int_compare_and_swap_release(addr, old, new_val) \
50 AO_compare_and_swap_release((volatile AO_t *)addr, \
51 (AO_t) old, (AO_t)new_val)
52 # define AO_HAVE_int_compare_and_swap_release
55 #if defined(AO_HAVE_compare_and_swap_write) && \
56 !defined(AO_HAVE_int_compare_and_swap_write)
57 # define AO_int_compare_and_swap_write(addr, old, new_val) \
58 AO_compare_and_swap_write((volatile AO_t *)addr, \
59 (AO_t) old, (AO_t)new_val)
60 # define AO_HAVE_int_compare_and_swap_write
63 #if defined(AO_HAVE_compare_and_swap_read) && \
64 !defined(AO_HAVE_int_compare_and_swap_read)
65 # define AO_int_compare_and_swap_read(addr, old, new_val) \
66 AO_compare_and_swap_read((volatile AO_t *)addr, \
67 (AO_t) old, (AO_t)new_val)
68 # define AO_HAVE_int_compare_and_swap_read
71 #if defined(AO_HAVE_compare_and_swap) && \
72 !defined(AO_HAVE_int_compare_and_swap)
73 # define AO_int_compare_and_swap(addr, old, new_val) \
74 AO_compare_and_swap((volatile AO_t *)addr, \
75 (AO_t) old, (AO_t)new_val)
76 # define AO_HAVE_int_compare_and_swap
79 #if defined(AO_HAVE_load_acquire) && \
80 !defined(AO_HAVE_int_load_acquire)
81 # define AO_int_load_acquire(addr) (int)AO_load_acquire((volatile AO_t *)addr)
82 # define AO_HAVE_int_load_acquire
85 #if defined(AO_HAVE_store_release) && \
86 !defined(AO_HAVE_int_store_release)
87 # define AO_int_store_release(addr, val) \
88 AO_store_release((volatile AO_t *)addr, (AO_t)val)
89 # define AO_HAVE_int_store_release
92 #if defined(AO_HAVE_fetch_and_add_full) && \
93 !defined(AO_HAVE_int_fetch_and_add_full)
94 # define AO_int_fetch_and_add_full(addr, incr) \
95 (int)AO_fetch_and_add_full((volatile AO_t *)addr, (AO_t)incr)
96 # define AO_HAVE_int_fetch_and_add_full
99 #if defined(AO_HAVE_fetch_and_add1_acquire) && \
100 !defined(AO_HAVE_int_fetch_and_add1_acquire)
101 # define AO_int_fetch_and_add1_acquire(addr) \
102 (int)AO_fetch_and_add1_acquire((volatile AO_t *)addr)
103 # define AO_HAVE_int_fetch_and_add1_acquire
106 #if defined(AO_HAVE_fetch_and_add1_release) && \
107 !defined(AO_HAVE_int_fetch_and_add1_release)
108 # define AO_int_fetch_and_add1_release(addr) \
109 (int)AO_fetch_and_add1_release((volatile AO_t *)addr)
110 # define AO_HAVE_int_fetch_and_add1_release
113 #if defined(AO_HAVE_fetch_and_sub1_acquire) && \
114 !defined(AO_HAVE_int_fetch_and_sub1_acquire)
115 # define AO_int_fetch_and_sub1_acquire(addr) \
116 (int)AO_fetch_and_sub1_acquire((volatile AO_t *)addr)
117 # define AO_HAVE_int_fetch_and_sub1_acquire
120 #if defined(AO_HAVE_fetch_and_sub1_release) && \
121 !defined(AO_HAVE_int_fetch_and_sub1_release)
122 # define AO_int_fetch_and_sub1_release(addr) \
123 (int)AO_fetch_and_sub1_release((volatile AO_t *)addr)
124 # define AO_HAVE_int_fetch_and_sub1_release