v / thirdparty / libatomic_ops / atomic_ops / sysdeps / ao_t_is_int.template
92 lines · 81 sloc · 3.82 KB · 90d9b200f999f611a27b604e7b26c76843fb8b7b
Raw
1/*
2 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
3 *
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:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
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
20 * SOFTWARE.
21 */
22
23/* Inclusion of this file signifies that AO_t is in fact int. */
24/* Hence any AO_... operation can also serve as AO_int_... operation. */
25
26#if defined(AO_HAVE_load_XBAR) && !defined(AO_HAVE_int_load_XBAR)
27# define AO_int_load_XBAR(addr) \
28 (unsigned)AO_load_XBAR((const volatile AO_t *)(addr))
29# define AO_HAVE_int_load_XBAR
30#endif
31
32#if defined(AO_HAVE_store_XBAR) && !defined(AO_HAVE_int_store_XBAR)
33# define AO_int_store_XBAR(addr, val) \
34 AO_store_XBAR((volatile AO_t *)(addr), (AO_t)(val))
35# define AO_HAVE_int_store_XBAR
36#endif
37
38#if defined(AO_HAVE_fetch_and_add_XBAR) \
39 && !defined(AO_HAVE_int_fetch_and_add_XBAR)
40# define AO_int_fetch_and_add_XBAR(addr, incr) \
41 (unsigned)AO_fetch_and_add_XBAR((volatile AO_t *)(addr), \
42 (AO_t)(incr))
43# define AO_HAVE_int_fetch_and_add_XBAR
44#endif
45
46#if defined(AO_HAVE_fetch_and_add1_XBAR) \
47 && !defined(AO_HAVE_int_fetch_and_add1_XBAR)
48# define AO_int_fetch_and_add1_XBAR(addr) \
49 (unsigned)AO_fetch_and_add1_XBAR((volatile AO_t *)(addr))
50# define AO_HAVE_int_fetch_and_add1_XBAR
51#endif
52
53#if defined(AO_HAVE_fetch_and_sub1_XBAR) \
54 && !defined(AO_HAVE_int_fetch_and_sub1_XBAR)
55# define AO_int_fetch_and_sub1_XBAR(addr) \
56 (unsigned)AO_fetch_and_sub1_XBAR((volatile AO_t *)(addr))
57# define AO_HAVE_int_fetch_and_sub1_XBAR
58#endif
59
60#if defined(AO_HAVE_and_XBAR) && !defined(AO_HAVE_int_and_XBAR)
61# define AO_int_and_XBAR(addr, val) \
62 AO_and_XBAR((volatile AO_t *)(addr), (AO_t)(val))
63# define AO_HAVE_int_and_XBAR
64#endif
65
66#if defined(AO_HAVE_or_XBAR) && !defined(AO_HAVE_int_or_XBAR)
67# define AO_int_or_XBAR(addr, val) \
68 AO_or_XBAR((volatile AO_t *)(addr), (AO_t)(val))
69# define AO_HAVE_int_or_XBAR
70#endif
71
72#if defined(AO_HAVE_xor_XBAR) && !defined(AO_HAVE_int_xor_XBAR)
73# define AO_int_xor_XBAR(addr, val) \
74 AO_xor_XBAR((volatile AO_t *)(addr), (AO_t)(val))
75# define AO_HAVE_int_xor_XBAR
76#endif
77
78#if defined(AO_HAVE_fetch_compare_and_swap_XBAR) \
79 && !defined(AO_HAVE_int_fetch_compare_and_swap_XBAR)
80# define AO_int_fetch_compare_and_swap_XBAR(addr, old, new_val) \
81 (unsigned)AO_fetch_compare_and_swap_XBAR((volatile AO_t *)(addr), \
82 (AO_t)(old), (AO_t)(new_val))
83# define AO_HAVE_int_fetch_compare_and_swap_XBAR
84#endif
85
86#if defined(AO_HAVE_compare_and_swap_XBAR) \
87 && !defined(AO_HAVE_int_compare_and_swap_XBAR)
88# define AO_int_compare_and_swap_XBAR(addr, old, new_val) \
89 AO_compare_and_swap_XBAR((volatile AO_t *)(addr), \
90 (AO_t)(old), (AO_t)(new_val))
91# define AO_HAVE_int_compare_and_swap_XBAR
92#endif
93