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) \
82 (int)AO_load_acquire((const volatile AO_t *)(addr))
83 # define AO_HAVE_int_load_acquire
86 #if defined(AO_HAVE_store_release) && \
87 !defined(AO_HAVE_int_store_release)
88 # define AO_int_store_release(addr, val) \
89 AO_store_release((volatile AO_t *)(addr), (AO_t)(val))
90 # define AO_HAVE_int_store_release
93 #if defined(AO_HAVE_fetch_and_add_full) && \
94 !defined(AO_HAVE_int_fetch_and_add_full)
95 # define AO_int_fetch_and_add_full(addr, incr) \
96 (int)AO_fetch_and_add_full((volatile AO_t *)(addr), (AO_t)(incr))
97 # define AO_HAVE_int_fetch_and_add_full
100 #if defined(AO_HAVE_fetch_and_add1_acquire) && \
101 !defined(AO_HAVE_int_fetch_and_add1_acquire)
102 # define AO_int_fetch_and_add1_acquire(addr) \
103 (int)AO_fetch_and_add1_acquire((volatile AO_t *)(addr))
104 # define AO_HAVE_int_fetch_and_add1_acquire
107 #if defined(AO_HAVE_fetch_and_add1_release) && \
108 !defined(AO_HAVE_int_fetch_and_add1_release)
109 # define AO_int_fetch_and_add1_release(addr) \
110 (int)AO_fetch_and_add1_release((volatile AO_t *)(addr))
111 # define AO_HAVE_int_fetch_and_add1_release
114 #if defined(AO_HAVE_fetch_and_sub1_acquire) && \
115 !defined(AO_HAVE_int_fetch_and_sub1_acquire)
116 # define AO_int_fetch_and_sub1_acquire(addr) \
117 (int)AO_fetch_and_sub1_acquire((volatile AO_t *)(addr))
118 # define AO_HAVE_int_fetch_and_sub1_acquire
121 #if defined(AO_HAVE_fetch_and_sub1_release) && \
122 !defined(AO_HAVE_int_fetch_and_sub1_release)
123 # define AO_int_fetch_and_sub1_release(addr) \
124 (int)AO_fetch_and_sub1_release((volatile AO_t *)(addr))
125 # define AO_HAVE_int_fetch_and_sub1_release