usermode/library/atomic_ops/ao_t_is_int.h

00001 /*
00002  * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to deal
00006  * in the Software without restriction, including without limitation the rights
00007  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008  * copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00020  * SOFTWARE.
00021  */
00022 
00023 /*
00024  * Inclusion of this file signifies that AO_t is in fact int.  Hence
00025  * any AO_... operations can also server as AO_int_... operations.
00026  * We currently define only the more important ones here, and allow for
00027  * the normal generalization process to define the others.
00028  * We should probably add others in the future.
00029  */
00030 
00031 #if defined(AO_HAVE_compare_and_swap_full) && \
00032     !defined(AO_HAVE_int_compare_and_swap_full)
00033 #  define AO_int_compare_and_swap_full(addr, old, new_val) \
00034                 AO_compare_and_swap_full((volatile AO_t *)(addr), \
00035                                         (AO_t)(old), (AO_t)(new_val))
00036 #  define AO_HAVE_int_compare_and_swap_full
00037 # endif
00038 
00039 #if defined(AO_HAVE_compare_and_swap_acquire) && \
00040     !defined(AO_HAVE_int_compare_and_swap_acquire)
00041 #  define AO_int_compare_and_swap_acquire(addr, old, new_val) \
00042                 AO_compare_and_swap_acquire((volatile AO_t *)(addr), \
00043                                             (AO_t)(old), (AO_t)(new_val))
00044 #  define AO_HAVE_int_compare_and_swap_acquire
00045 # endif
00046 
00047 #if defined(AO_HAVE_compare_and_swap_release) && \
00048     !defined(AO_HAVE_int_compare_and_swap_release)
00049 #  define AO_int_compare_and_swap_release(addr, old, new_val) \
00050                 AO_compare_and_swap_release((volatile AO_t *)(addr), \
00051                                          (AO_t)(old), (AO_t)(new_val))
00052 #  define AO_HAVE_int_compare_and_swap_release
00053 # endif
00054 
00055 #if defined(AO_HAVE_compare_and_swap_write) && \
00056     !defined(AO_HAVE_int_compare_and_swap_write)
00057 #  define AO_int_compare_and_swap_write(addr, old, new_val) \
00058                 AO_compare_and_swap_write((volatile AO_t *)(addr), \
00059                                           (AO_t)(old), (AO_t)(new_val))
00060 #  define AO_HAVE_int_compare_and_swap_write
00061 # endif
00062 
00063 #if defined(AO_HAVE_compare_and_swap_read) && \
00064     !defined(AO_HAVE_int_compare_and_swap_read)
00065 #  define AO_int_compare_and_swap_read(addr, old, new_val) \
00066                 AO_compare_and_swap_read((volatile AO_t *)(addr), \
00067                                          (AO_t)(old), (AO_t)(new_val))
00068 #  define AO_HAVE_int_compare_and_swap_read
00069 # endif
00070 
00071 #if defined(AO_HAVE_compare_and_swap) && \
00072     !defined(AO_HAVE_int_compare_and_swap)
00073 #  define AO_int_compare_and_swap(addr, old, new_val) \
00074                 AO_compare_and_swap((volatile AO_t *)(addr), \
00075                                     (AO_t)(old), (AO_t)(new_val))
00076 #  define AO_HAVE_int_compare_and_swap
00077 # endif
00078 
00079 #if defined(AO_HAVE_load_acquire) && \
00080     !defined(AO_HAVE_int_load_acquire)
00081 #  define AO_int_load_acquire(addr) \
00082         (int)AO_load_acquire((const volatile AO_t *)(addr))
00083 #  define AO_HAVE_int_load_acquire
00084 # endif
00085 
00086 #if defined(AO_HAVE_store_release) && \
00087     !defined(AO_HAVE_int_store_release)
00088 #  define AO_int_store_release(addr, val) \
00089         AO_store_release((volatile AO_t *)(addr), (AO_t)(val))
00090 #  define AO_HAVE_int_store_release
00091 # endif
00092 
00093 #if defined(AO_HAVE_fetch_and_add_full) && \
00094     !defined(AO_HAVE_int_fetch_and_add_full)
00095 #  define AO_int_fetch_and_add_full(addr, incr) \
00096         (int)AO_fetch_and_add_full((volatile AO_t *)(addr), (AO_t)(incr))
00097 #  define AO_HAVE_int_fetch_and_add_full
00098 # endif
00099 
00100 #if defined(AO_HAVE_fetch_and_add1_acquire) && \
00101     !defined(AO_HAVE_int_fetch_and_add1_acquire)
00102 #  define AO_int_fetch_and_add1_acquire(addr) \
00103         (int)AO_fetch_and_add1_acquire((volatile AO_t *)(addr))
00104 #  define AO_HAVE_int_fetch_and_add1_acquire
00105 # endif
00106 
00107 #if defined(AO_HAVE_fetch_and_add1_release) && \
00108     !defined(AO_HAVE_int_fetch_and_add1_release)
00109 #  define AO_int_fetch_and_add1_release(addr) \
00110         (int)AO_fetch_and_add1_release((volatile AO_t *)(addr))
00111 #  define AO_HAVE_int_fetch_and_add1_release
00112 # endif
00113 
00114 #if defined(AO_HAVE_fetch_and_sub1_acquire) && \
00115     !defined(AO_HAVE_int_fetch_and_sub1_acquire)
00116 #  define AO_int_fetch_and_sub1_acquire(addr) \
00117         (int)AO_fetch_and_sub1_acquire((volatile AO_t *)(addr))
00118 #  define AO_HAVE_int_fetch_and_sub1_acquire
00119 # endif
00120 
00121 #if defined(AO_HAVE_fetch_and_sub1_release) && \
00122     !defined(AO_HAVE_int_fetch_and_sub1_release)
00123 #  define AO_int_fetch_and_sub1_release(addr) \
00124         (int)AO_fetch_and_sub1_release((volatile AO_t *)(addr))
00125 #  define AO_HAVE_int_fetch_and_sub1_release
00126 # endif

Generated on Sat Apr 23 11:43:34 2011 for Mnemosyne by  doxygen 1.4.7