| 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) && !defined(AO_HAVE_int_load) |
| 27 | # define AO_int_load(addr) \ |
| 28 | (unsigned)AO_load((const volatile AO_t *)(addr)) |
| 29 | # define AO_HAVE_int_load |
| 30 | #endif |
| 31 | |
| 32 | #if defined(AO_HAVE_store) && !defined(AO_HAVE_int_store) |
| 33 | # define AO_int_store(addr, val) \ |
| 34 | AO_store((volatile AO_t *)(addr), (AO_t)(val)) |
| 35 | # define AO_HAVE_int_store |
| 36 | #endif |
| 37 | |
| 38 | #if defined(AO_HAVE_fetch_and_add) \ |
| 39 | && !defined(AO_HAVE_int_fetch_and_add) |
| 40 | # define AO_int_fetch_and_add(addr, incr) \ |
| 41 | (unsigned)AO_fetch_and_add((volatile AO_t *)(addr), \ |
| 42 | (AO_t)(incr)) |
| 43 | # define AO_HAVE_int_fetch_and_add |
| 44 | #endif |
| 45 | |
| 46 | #if defined(AO_HAVE_fetch_and_add1) \ |
| 47 | && !defined(AO_HAVE_int_fetch_and_add1) |
| 48 | # define AO_int_fetch_and_add1(addr) \ |
| 49 | (unsigned)AO_fetch_and_add1((volatile AO_t *)(addr)) |
| 50 | # define AO_HAVE_int_fetch_and_add1 |
| 51 | #endif |
| 52 | |
| 53 | #if defined(AO_HAVE_fetch_and_sub1) \ |
| 54 | && !defined(AO_HAVE_int_fetch_and_sub1) |
| 55 | # define AO_int_fetch_and_sub1(addr) \ |
| 56 | (unsigned)AO_fetch_and_sub1((volatile AO_t *)(addr)) |
| 57 | # define AO_HAVE_int_fetch_and_sub1 |
| 58 | #endif |
| 59 | |
| 60 | #if defined(AO_HAVE_and) && !defined(AO_HAVE_int_and) |
| 61 | # define AO_int_and(addr, val) \ |
| 62 | AO_and((volatile AO_t *)(addr), (AO_t)(val)) |
| 63 | # define AO_HAVE_int_and |
| 64 | #endif |
| 65 | |
| 66 | #if defined(AO_HAVE_or) && !defined(AO_HAVE_int_or) |
| 67 | # define AO_int_or(addr, val) \ |
| 68 | AO_or((volatile AO_t *)(addr), (AO_t)(val)) |
| 69 | # define AO_HAVE_int_or |
| 70 | #endif |
| 71 | |
| 72 | #if defined(AO_HAVE_xor) && !defined(AO_HAVE_int_xor) |
| 73 | # define AO_int_xor(addr, val) \ |
| 74 | AO_xor((volatile AO_t *)(addr), (AO_t)(val)) |
| 75 | # define AO_HAVE_int_xor |
| 76 | #endif |
| 77 | |
| 78 | #if defined(AO_HAVE_fetch_compare_and_swap) \ |
| 79 | && !defined(AO_HAVE_int_fetch_compare_and_swap) |
| 80 | # define AO_int_fetch_compare_and_swap(addr, old, new_val) \ |
| 81 | (unsigned)AO_fetch_compare_and_swap((volatile AO_t *)(addr), \ |
| 82 | (AO_t)(old), (AO_t)(new_val)) |
| 83 | # define AO_HAVE_int_fetch_compare_and_swap |
| 84 | #endif |
| 85 | |
| 86 | #if defined(AO_HAVE_compare_and_swap) \ |
| 87 | && !defined(AO_HAVE_int_compare_and_swap) |
| 88 | # define AO_int_compare_and_swap(addr, old, new_val) \ |
| 89 | AO_compare_and_swap((volatile AO_t *)(addr), \ |
| 90 | (AO_t)(old), (AO_t)(new_val)) |
| 91 | # define AO_HAVE_int_compare_and_swap |
| 92 | #endif |
| 93 | /* |
| 94 | * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. |
| 95 | * |
| 96 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 97 | * of this software and associated documentation files (the "Software"), to deal |
| 98 | * in the Software without restriction, including without limitation the rights |
| 99 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 100 | * copies of the Software, and to permit persons to whom the Software is |
| 101 | * furnished to do so, subject to the following conditions: |
| 102 | * |
| 103 | * The above copyright notice and this permission notice shall be included in |
| 104 | * all copies or substantial portions of the Software. |
| 105 | * |
| 106 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 107 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 108 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 109 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 110 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 111 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 112 | * SOFTWARE. |
| 113 | */ |
| 114 | |
| 115 | /* Inclusion of this file signifies that AO_t is in fact int. */ |
| 116 | /* Hence any AO_... operation can also serve as AO_int_... operation. */ |
| 117 | |
| 118 | #if defined(AO_HAVE_load_full) && !defined(AO_HAVE_int_load_full) |
| 119 | # define AO_int_load_full(addr) \ |
| 120 | (unsigned)AO_load_full((const volatile AO_t *)(addr)) |
| 121 | # define AO_HAVE_int_load_full |
| 122 | #endif |
| 123 | |
| 124 | #if defined(AO_HAVE_store_full) && !defined(AO_HAVE_int_store_full) |
| 125 | # define AO_int_store_full(addr, val) \ |
| 126 | AO_store_full((volatile AO_t *)(addr), (AO_t)(val)) |
| 127 | # define AO_HAVE_int_store_full |
| 128 | #endif |
| 129 | |
| 130 | #if defined(AO_HAVE_fetch_and_add_full) \ |
| 131 | && !defined(AO_HAVE_int_fetch_and_add_full) |
| 132 | # define AO_int_fetch_and_add_full(addr, incr) \ |
| 133 | (unsigned)AO_fetch_and_add_full((volatile AO_t *)(addr), \ |
| 134 | (AO_t)(incr)) |
| 135 | # define AO_HAVE_int_fetch_and_add_full |
| 136 | #endif |
| 137 | |
| 138 | #if defined(AO_HAVE_fetch_and_add1_full) \ |
| 139 | && !defined(AO_HAVE_int_fetch_and_add1_full) |
| 140 | # define AO_int_fetch_and_add1_full(addr) \ |
| 141 | (unsigned)AO_fetch_and_add1_full((volatile AO_t *)(addr)) |
| 142 | # define AO_HAVE_int_fetch_and_add1_full |
| 143 | #endif |
| 144 | |
| 145 | #if defined(AO_HAVE_fetch_and_sub1_full) \ |
| 146 | && !defined(AO_HAVE_int_fetch_and_sub1_full) |
| 147 | # define AO_int_fetch_and_sub1_full(addr) \ |
| 148 | (unsigned)AO_fetch_and_sub1_full((volatile AO_t *)(addr)) |
| 149 | # define AO_HAVE_int_fetch_and_sub1_full |
| 150 | #endif |
| 151 | |
| 152 | #if defined(AO_HAVE_and_full) && !defined(AO_HAVE_int_and_full) |
| 153 | # define AO_int_and_full(addr, val) \ |
| 154 | AO_and_full((volatile AO_t *)(addr), (AO_t)(val)) |
| 155 | # define AO_HAVE_int_and_full |
| 156 | #endif |
| 157 | |
| 158 | #if defined(AO_HAVE_or_full) && !defined(AO_HAVE_int_or_full) |
| 159 | # define AO_int_or_full(addr, val) \ |
| 160 | AO_or_full((volatile AO_t *)(addr), (AO_t)(val)) |
| 161 | # define AO_HAVE_int_or_full |
| 162 | #endif |
| 163 | |
| 164 | #if defined(AO_HAVE_xor_full) && !defined(AO_HAVE_int_xor_full) |
| 165 | # define AO_int_xor_full(addr, val) \ |
| 166 | AO_xor_full((volatile AO_t *)(addr), (AO_t)(val)) |
| 167 | # define AO_HAVE_int_xor_full |
| 168 | #endif |
| 169 | |
| 170 | #if defined(AO_HAVE_fetch_compare_and_swap_full) \ |
| 171 | && !defined(AO_HAVE_int_fetch_compare_and_swap_full) |
| 172 | # define AO_int_fetch_compare_and_swap_full(addr, old, new_val) \ |
| 173 | (unsigned)AO_fetch_compare_and_swap_full((volatile AO_t *)(addr), \ |
| 174 | (AO_t)(old), (AO_t)(new_val)) |
| 175 | # define AO_HAVE_int_fetch_compare_and_swap_full |
| 176 | #endif |
| 177 | |
| 178 | #if defined(AO_HAVE_compare_and_swap_full) \ |
| 179 | && !defined(AO_HAVE_int_compare_and_swap_full) |
| 180 | # define AO_int_compare_and_swap_full(addr, old, new_val) \ |
| 181 | AO_compare_and_swap_full((volatile AO_t *)(addr), \ |
| 182 | (AO_t)(old), (AO_t)(new_val)) |
| 183 | # define AO_HAVE_int_compare_and_swap_full |
| 184 | #endif |
| 185 | /* |
| 186 | * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. |
| 187 | * |
| 188 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 189 | * of this software and associated documentation files (the "Software"), to deal |
| 190 | * in the Software without restriction, including without limitation the rights |
| 191 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 192 | * copies of the Software, and to permit persons to whom the Software is |
| 193 | * furnished to do so, subject to the following conditions: |
| 194 | * |
| 195 | * The above copyright notice and this permission notice shall be included in |
| 196 | * all copies or substantial portions of the Software. |
| 197 | * |
| 198 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 199 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 200 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 201 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 202 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 203 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 204 | * SOFTWARE. |
| 205 | */ |
| 206 | |
| 207 | /* Inclusion of this file signifies that AO_t is in fact int. */ |
| 208 | /* Hence any AO_... operation can also serve as AO_int_... operation. */ |
| 209 | |
| 210 | #if defined(AO_HAVE_load_acquire) && !defined(AO_HAVE_int_load_acquire) |
| 211 | # define AO_int_load_acquire(addr) \ |
| 212 | (unsigned)AO_load_acquire((const volatile AO_t *)(addr)) |
| 213 | # define AO_HAVE_int_load_acquire |
| 214 | #endif |
| 215 | |
| 216 | #if defined(AO_HAVE_store_acquire) && !defined(AO_HAVE_int_store_acquire) |
| 217 | # define AO_int_store_acquire(addr, val) \ |
| 218 | AO_store_acquire((volatile AO_t *)(addr), (AO_t)(val)) |
| 219 | # define AO_HAVE_int_store_acquire |
| 220 | #endif |
| 221 | |
| 222 | #if defined(AO_HAVE_fetch_and_add_acquire) \ |
| 223 | && !defined(AO_HAVE_int_fetch_and_add_acquire) |
| 224 | # define AO_int_fetch_and_add_acquire(addr, incr) \ |
| 225 | (unsigned)AO_fetch_and_add_acquire((volatile AO_t *)(addr), \ |
| 226 | (AO_t)(incr)) |
| 227 | # define AO_HAVE_int_fetch_and_add_acquire |
| 228 | #endif |
| 229 | |
| 230 | #if defined(AO_HAVE_fetch_and_add1_acquire) \ |
| 231 | && !defined(AO_HAVE_int_fetch_and_add1_acquire) |
| 232 | # define AO_int_fetch_and_add1_acquire(addr) \ |
| 233 | (unsigned)AO_fetch_and_add1_acquire((volatile AO_t *)(addr)) |
| 234 | # define AO_HAVE_int_fetch_and_add1_acquire |
| 235 | #endif |
| 236 | |
| 237 | #if defined(AO_HAVE_fetch_and_sub1_acquire) \ |
| 238 | && !defined(AO_HAVE_int_fetch_and_sub1_acquire) |
| 239 | # define AO_int_fetch_and_sub1_acquire(addr) \ |
| 240 | (unsigned)AO_fetch_and_sub1_acquire((volatile AO_t *)(addr)) |
| 241 | # define AO_HAVE_int_fetch_and_sub1_acquire |
| 242 | #endif |
| 243 | |
| 244 | #if defined(AO_HAVE_and_acquire) && !defined(AO_HAVE_int_and_acquire) |
| 245 | # define AO_int_and_acquire(addr, val) \ |
| 246 | AO_and_acquire((volatile AO_t *)(addr), (AO_t)(val)) |
| 247 | # define AO_HAVE_int_and_acquire |
| 248 | #endif |
| 249 | |
| 250 | #if defined(AO_HAVE_or_acquire) && !defined(AO_HAVE_int_or_acquire) |
| 251 | # define AO_int_or_acquire(addr, val) \ |
| 252 | AO_or_acquire((volatile AO_t *)(addr), (AO_t)(val)) |
| 253 | # define AO_HAVE_int_or_acquire |
| 254 | #endif |
| 255 | |
| 256 | #if defined(AO_HAVE_xor_acquire) && !defined(AO_HAVE_int_xor_acquire) |
| 257 | # define AO_int_xor_acquire(addr, val) \ |
| 258 | AO_xor_acquire((volatile AO_t *)(addr), (AO_t)(val)) |
| 259 | # define AO_HAVE_int_xor_acquire |
| 260 | #endif |
| 261 | |
| 262 | #if defined(AO_HAVE_fetch_compare_and_swap_acquire) \ |
| 263 | && !defined(AO_HAVE_int_fetch_compare_and_swap_acquire) |
| 264 | # define AO_int_fetch_compare_and_swap_acquire(addr, old, new_val) \ |
| 265 | (unsigned)AO_fetch_compare_and_swap_acquire((volatile AO_t *)(addr), \ |
| 266 | (AO_t)(old), (AO_t)(new_val)) |
| 267 | # define AO_HAVE_int_fetch_compare_and_swap_acquire |
| 268 | #endif |
| 269 | |
| 270 | #if defined(AO_HAVE_compare_and_swap_acquire) \ |
| 271 | && !defined(AO_HAVE_int_compare_and_swap_acquire) |
| 272 | # define AO_int_compare_and_swap_acquire(addr, old, new_val) \ |
| 273 | AO_compare_and_swap_acquire((volatile AO_t *)(addr), \ |
| 274 | (AO_t)(old), (AO_t)(new_val)) |
| 275 | # define AO_HAVE_int_compare_and_swap_acquire |
| 276 | #endif |
| 277 | /* |
| 278 | * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. |
| 279 | * |
| 280 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 281 | * of this software and associated documentation files (the "Software"), to deal |
| 282 | * in the Software without restriction, including without limitation the rights |
| 283 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 284 | * copies of the Software, and to permit persons to whom the Software is |
| 285 | * furnished to do so, subject to the following conditions: |
| 286 | * |
| 287 | * The above copyright notice and this permission notice shall be included in |
| 288 | * all copies or substantial portions of the Software. |
| 289 | * |
| 290 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 291 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 292 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 293 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 294 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 295 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 296 | * SOFTWARE. |
| 297 | */ |
| 298 | |
| 299 | /* Inclusion of this file signifies that AO_t is in fact int. */ |
| 300 | /* Hence any AO_... operation can also serve as AO_int_... operation. */ |
| 301 | |
| 302 | #if defined(AO_HAVE_load_release) && !defined(AO_HAVE_int_load_release) |
| 303 | # define AO_int_load_release(addr) \ |
| 304 | (unsigned)AO_load_release((const volatile AO_t *)(addr)) |
| 305 | # define AO_HAVE_int_load_release |
| 306 | #endif |
| 307 | |
| 308 | #if defined(AO_HAVE_store_release) && !defined(AO_HAVE_int_store_release) |
| 309 | # define AO_int_store_release(addr, val) \ |
| 310 | AO_store_release((volatile AO_t *)(addr), (AO_t)(val)) |
| 311 | # define AO_HAVE_int_store_release |
| 312 | #endif |
| 313 | |
| 314 | #if defined(AO_HAVE_fetch_and_add_release) \ |
| 315 | && !defined(AO_HAVE_int_fetch_and_add_release) |
| 316 | # define AO_int_fetch_and_add_release(addr, incr) \ |
| 317 | (unsigned)AO_fetch_and_add_release((volatile AO_t *)(addr), \ |
| 318 | (AO_t)(incr)) |
| 319 | # define AO_HAVE_int_fetch_and_add_release |
| 320 | #endif |
| 321 | |
| 322 | #if defined(AO_HAVE_fetch_and_add1_release) \ |
| 323 | && !defined(AO_HAVE_int_fetch_and_add1_release) |
| 324 | # define AO_int_fetch_and_add1_release(addr) \ |
| 325 | (unsigned)AO_fetch_and_add1_release((volatile AO_t *)(addr)) |
| 326 | # define AO_HAVE_int_fetch_and_add1_release |
| 327 | #endif |
| 328 | |
| 329 | #if defined(AO_HAVE_fetch_and_sub1_release) \ |
| 330 | && !defined(AO_HAVE_int_fetch_and_sub1_release) |
| 331 | # define AO_int_fetch_and_sub1_release(addr) \ |
| 332 | (unsigned)AO_fetch_and_sub1_release((volatile AO_t *)(addr)) |
| 333 | # define AO_HAVE_int_fetch_and_sub1_release |
| 334 | #endif |
| 335 | |
| 336 | #if defined(AO_HAVE_and_release) && !defined(AO_HAVE_int_and_release) |
| 337 | # define AO_int_and_release(addr, val) \ |
| 338 | AO_and_release((volatile AO_t *)(addr), (AO_t)(val)) |
| 339 | # define AO_HAVE_int_and_release |
| 340 | #endif |
| 341 | |
| 342 | #if defined(AO_HAVE_or_release) && !defined(AO_HAVE_int_or_release) |
| 343 | # define AO_int_or_release(addr, val) \ |
| 344 | AO_or_release((volatile AO_t *)(addr), (AO_t)(val)) |
| 345 | # define AO_HAVE_int_or_release |
| 346 | #endif |
| 347 | |
| 348 | #if defined(AO_HAVE_xor_release) && !defined(AO_HAVE_int_xor_release) |
| 349 | # define AO_int_xor_release(addr, val) \ |
| 350 | AO_xor_release((volatile AO_t *)(addr), (AO_t)(val)) |
| 351 | # define AO_HAVE_int_xor_release |
| 352 | #endif |
| 353 | |
| 354 | #if defined(AO_HAVE_fetch_compare_and_swap_release) \ |
| 355 | && !defined(AO_HAVE_int_fetch_compare_and_swap_release) |
| 356 | # define AO_int_fetch_compare_and_swap_release(addr, old, new_val) \ |
| 357 | (unsigned)AO_fetch_compare_and_swap_release((volatile AO_t *)(addr), \ |
| 358 | (AO_t)(old), (AO_t)(new_val)) |
| 359 | # define AO_HAVE_int_fetch_compare_and_swap_release |
| 360 | #endif |
| 361 | |
| 362 | #if defined(AO_HAVE_compare_and_swap_release) \ |
| 363 | && !defined(AO_HAVE_int_compare_and_swap_release) |
| 364 | # define AO_int_compare_and_swap_release(addr, old, new_val) \ |
| 365 | AO_compare_and_swap_release((volatile AO_t *)(addr), \ |
| 366 | (AO_t)(old), (AO_t)(new_val)) |
| 367 | # define AO_HAVE_int_compare_and_swap_release |
| 368 | #endif |
| 369 | /* |
| 370 | * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. |
| 371 | * |
| 372 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 373 | * of this software and associated documentation files (the "Software"), to deal |
| 374 | * in the Software without restriction, including without limitation the rights |
| 375 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 376 | * copies of the Software, and to permit persons to whom the Software is |
| 377 | * furnished to do so, subject to the following conditions: |
| 378 | * |
| 379 | * The above copyright notice and this permission notice shall be included in |
| 380 | * all copies or substantial portions of the Software. |
| 381 | * |
| 382 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 383 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 384 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 385 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 386 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 387 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 388 | * SOFTWARE. |
| 389 | */ |
| 390 | |
| 391 | /* Inclusion of this file signifies that AO_t is in fact int. */ |
| 392 | /* Hence any AO_... operation can also serve as AO_int_... operation. */ |
| 393 | |
| 394 | #if defined(AO_HAVE_load_write) && !defined(AO_HAVE_int_load_write) |
| 395 | # define AO_int_load_write(addr) \ |
| 396 | (unsigned)AO_load_write((const volatile AO_t *)(addr)) |
| 397 | # define AO_HAVE_int_load_write |
| 398 | #endif |
| 399 | |
| 400 | #if defined(AO_HAVE_store_write) && !defined(AO_HAVE_int_store_write) |
| 401 | # define AO_int_store_write(addr, val) \ |
| 402 | AO_store_write((volatile AO_t *)(addr), (AO_t)(val)) |
| 403 | # define AO_HAVE_int_store_write |
| 404 | #endif |
| 405 | |
| 406 | #if defined(AO_HAVE_fetch_and_add_write) \ |
| 407 | && !defined(AO_HAVE_int_fetch_and_add_write) |
| 408 | # define AO_int_fetch_and_add_write(addr, incr) \ |
| 409 | (unsigned)AO_fetch_and_add_write((volatile AO_t *)(addr), \ |
| 410 | (AO_t)(incr)) |
| 411 | # define AO_HAVE_int_fetch_and_add_write |
| 412 | #endif |
| 413 | |
| 414 | #if defined(AO_HAVE_fetch_and_add1_write) \ |
| 415 | && !defined(AO_HAVE_int_fetch_and_add1_write) |
| 416 | # define AO_int_fetch_and_add1_write(addr) \ |
| 417 | (unsigned)AO_fetch_and_add1_write((volatile AO_t *)(addr)) |
| 418 | # define AO_HAVE_int_fetch_and_add1_write |
| 419 | #endif |
| 420 | |
| 421 | #if defined(AO_HAVE_fetch_and_sub1_write) \ |
| 422 | && !defined(AO_HAVE_int_fetch_and_sub1_write) |
| 423 | # define AO_int_fetch_and_sub1_write(addr) \ |
| 424 | (unsigned)AO_fetch_and_sub1_write((volatile AO_t *)(addr)) |
| 425 | # define AO_HAVE_int_fetch_and_sub1_write |
| 426 | #endif |
| 427 | |
| 428 | #if defined(AO_HAVE_and_write) && !defined(AO_HAVE_int_and_write) |
| 429 | # define AO_int_and_write(addr, val) \ |
| 430 | AO_and_write((volatile AO_t *)(addr), (AO_t)(val)) |
| 431 | # define AO_HAVE_int_and_write |
| 432 | #endif |
| 433 | |
| 434 | #if defined(AO_HAVE_or_write) && !defined(AO_HAVE_int_or_write) |
| 435 | # define AO_int_or_write(addr, val) \ |
| 436 | AO_or_write((volatile AO_t *)(addr), (AO_t)(val)) |
| 437 | # define AO_HAVE_int_or_write |
| 438 | #endif |
| 439 | |
| 440 | #if defined(AO_HAVE_xor_write) && !defined(AO_HAVE_int_xor_write) |
| 441 | # define AO_int_xor_write(addr, val) \ |
| 442 | AO_xor_write((volatile AO_t *)(addr), (AO_t)(val)) |
| 443 | # define AO_HAVE_int_xor_write |
| 444 | #endif |
| 445 | |
| 446 | #if defined(AO_HAVE_fetch_compare_and_swap_write) \ |
| 447 | && !defined(AO_HAVE_int_fetch_compare_and_swap_write) |
| 448 | # define AO_int_fetch_compare_and_swap_write(addr, old, new_val) \ |
| 449 | (unsigned)AO_fetch_compare_and_swap_write((volatile AO_t *)(addr), \ |
| 450 | (AO_t)(old), (AO_t)(new_val)) |
| 451 | # define AO_HAVE_int_fetch_compare_and_swap_write |
| 452 | #endif |
| 453 | |
| 454 | #if defined(AO_HAVE_compare_and_swap_write) \ |
| 455 | && !defined(AO_HAVE_int_compare_and_swap_write) |
| 456 | # define AO_int_compare_and_swap_write(addr, old, new_val) \ |
| 457 | AO_compare_and_swap_write((volatile AO_t *)(addr), \ |
| 458 | (AO_t)(old), (AO_t)(new_val)) |
| 459 | # define AO_HAVE_int_compare_and_swap_write |
| 460 | #endif |
| 461 | /* |
| 462 | * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P. |
| 463 | * |
| 464 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 465 | * of this software and associated documentation files (the "Software"), to deal |
| 466 | * in the Software without restriction, including without limitation the rights |
| 467 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 468 | * copies of the Software, and to permit persons to whom the Software is |
| 469 | * furnished to do so, subject to the following conditions: |
| 470 | * |
| 471 | * The above copyright notice and this permission notice shall be included in |
| 472 | * all copies or substantial portions of the Software. |
| 473 | * |
| 474 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 475 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 476 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 477 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 478 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 479 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 480 | * SOFTWARE. |
| 481 | */ |
| 482 | |
| 483 | /* Inclusion of this file signifies that AO_t is in fact int. */ |
| 484 | /* Hence any AO_... operation can also serve as AO_int_... operation. */ |
| 485 | |
| 486 | #if defined(AO_HAVE_load_read) && !defined(AO_HAVE_int_load_read) |
| 487 | # define AO_int_load_read(addr) \ |
| 488 | (unsigned)AO_load_read((const volatile AO_t *)(addr)) |
| 489 | # define AO_HAVE_int_load_read |
| 490 | #endif |
| 491 | |
| 492 | #if defined(AO_HAVE_store_read) && !defined(AO_HAVE_int_store_read) |
| 493 | # define AO_int_store_read(addr, val) \ |
| 494 | AO_store_read((volatile AO_t *)(addr), (AO_t)(val)) |
| 495 | # define AO_HAVE_int_store_read |
| 496 | #endif |
| 497 | |
| 498 | #if defined(AO_HAVE_fetch_and_add_read) \ |
| 499 | && !defined(AO_HAVE_int_fetch_and_add_read) |
| 500 | # define AO_int_fetch_and_add_read(addr, incr) \ |
| 501 | (unsigned)AO_fetch_and_add_read((volatile AO_t *)(addr), \ |
| 502 | (AO_t)(incr)) |
| 503 | # define AO_HAVE_int_fetch_and_add_read |
| 504 | #endif |
| 505 | |
| 506 | #if defined(AO_HAVE_fetch_and_add1_read) \ |
| 507 | && !defined(AO_HAVE_int_fetch_and_add1_read) |
| 508 | # define AO_int_fetch_and_add1_read(addr) \ |
| 509 | (unsigned)AO_fetch_and_add1_read((volatile AO_t *)(addr)) |
| 510 | # define AO_HAVE_int_fetch_and_add1_read |
| 511 | #endif |
| 512 | |
| 513 | #if defined(AO_HAVE_fetch_and_sub1_read) \ |
| 514 | && !defined(AO_HAVE_int_fetch_and_sub1_read) |
| 515 | # define AO_int_fetch_and_sub1_read(addr) \ |
| 516 | (unsigned)AO_fetch_and_sub1_read((volatile AO_t *)(addr)) |
| 517 | # define AO_HAVE_int_fetch_and_sub1_read |
| 518 | #endif |
| 519 | |
| 520 | #if defined(AO_HAVE_and_read) && !defined(AO_HAVE_int_and_read) |
| 521 | # define AO_int_and_read(addr, val) \ |
| 522 | AO_and_read((volatile AO_t *)(addr), (AO_t)(val)) |
| 523 | # define AO_HAVE_int_and_read |
| 524 | #endif |
| 525 | |
| 526 | #if defined(AO_HAVE_or_read) && !defined(AO_HAVE_int_or_read) |
| 527 | # define AO_int_or_read(addr, val) \ |
| 528 | AO_or_read((volatile AO_t *)(addr), (AO_t)(val)) |
| 529 | # define AO_HAVE_int_or_read |
| 530 | #endif |
| 531 | |
| 532 | #if defined(AO_HAVE_xor_read) && !defined(AO_HAVE_int_xor_read) |
| 533 | # define AO_int_xor_read(addr, val) \ |
| 534 | AO_xor_read((volatile AO_t *)(addr), (AO_t)(val)) |
| 535 | # define AO_HAVE_int_xor_read |
| 536 | #endif |
| 537 | |
| 538 | #if defined(AO_HAVE_fetch_compare_and_swap_read) \ |
| 539 | && !defined(AO_HAVE_int_fetch_compare_and_swap_read) |
| 540 | # define AO_int_fetch_compare_and_swap_read(addr, old, new_val) \ |
| 541 | (unsigned)AO_fetch_compare_and_swap_read((volatile AO_t *)(addr), \ |
| 542 | (AO_t)(old), (AO_t)(new_val)) |
| 543 | # define AO_HAVE_int_fetch_compare_and_swap_read |
| 544 | #endif |
| 545 | |
| 546 | #if defined(AO_HAVE_compare_and_swap_read) \ |
| 547 | && !defined(AO_HAVE_int_compare_and_swap_read) |
| 548 | # define AO_int_compare_and_swap_read(addr, old, new_val) \ |
| 549 | AO_compare_and_swap_read((volatile AO_t *)(addr), \ |
| 550 | (AO_t)(old), (AO_t)(new_val)) |
| 551 | # define AO_HAVE_int_compare_and_swap_read |
| 552 | #endif |
| 553 | |