rambrain
rambrain_atomics.h
Go to the documentation of this file.
1 /* rambrain - a dynamical physical memory extender
2  * Copyright (C) 2015 M. Imgrund, A. Arth
3  * mimgrund (at) mpifr-bonn.mpg.de
4  * arth (at) usm.uni-muenchen.de
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef MEMBRAINATOMICS_H
21 #define MEMBRAINATOMICS_H
22 
23 //We want to use a clever logic here to be more portable...
24 
25 //GCC atomics
26 #define rambrain_atomic_fetch_add(a,b) __sync_fetch_and_add(a,b)
27 #define rambrain_atomic_fetch_sub(a,b) __sync_fetch_and_sub(a,b)
28 #define rambrain_atomic_add_fetch(a,b) __sync_add_and_fetch(a,b)
29 #define rambrain_atomic_sub_fetch(a,b) __sync_sub_and_fetch(a,b)
30 #define rambrain_atomic_bool_compare_and_swap(ptr,oldval,newval) __sync_bool_compare_and_swap(ptr,oldval,newval)
31 
32 
33 #endif