~ubuntu-branches/ubuntu/quantal/libgc/quantal

« back to all changes in this revision

Viewing changes to libatomic_ops-1.2/src/atomic_ops/sysdeps/ao_t_is_int.h

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2011-02-19 12:19:56 UTC
  • mfrom: (1.3.2 upstream) (0.1.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20110219121956-67rb69xlt5nud3v2
Tags: 1:7.1-5
Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2003-2004 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
/*
 
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.
 
29
 */
 
30
 
 
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
 
37
# endif
 
38
 
 
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
 
45
# endif
 
46
 
 
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
 
53
# endif
 
54
 
 
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
 
61
# endif
 
62
 
 
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
 
69
# endif
 
70
 
 
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
 
77
# endif
 
78
 
 
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
 
83
# endif
 
84
 
 
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
 
90
# endif
 
91
 
 
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
 
97
# endif
 
98
 
 
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
 
104
# endif
 
105
 
 
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
 
111
# endif
 
112
 
 
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
 
118
# endif
 
119
 
 
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
 
125
# endif
 
126