1 /*
2  * atomic.h
3  *
4  *  Created on: 11 янв. 2020 г.
5  *      Author: Vladimir Sadovnikov <lsp.plugin@gmail.com>
6  *
7  * This file is part of tamgamp.lv2 <https://github.com/sadko4u/tamgamp.lv2>.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 3 of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22  */
23 
24 #ifndef TAMGAMP_LV2_ATOMIC_H_
25 #define TAMGAMP_LV2_ATOMIC_H_
26 
27 #include <stdint.h>
28 
29 namespace tamgamp_lv2
30 {
atomic_get(volatile int32_t & var)31     inline int32_t atomic_get(volatile int32_t &var) { return var; }
atomic_get(volatile uint32_t & var)32     inline uint32_t atomic_get(volatile uint32_t &var) { return var; }
atomic_get(volatile int32_t * var)33     inline int32_t atomic_get(volatile int32_t *var) { return *var; }
atomic_get(volatile uint32_t * var)34     inline uint32_t atomic_get(volatile uint32_t *var) { return *var; }
35 
atomic_set(volatile int32_t & var,int32_t value)36     inline int32_t atomic_set(volatile int32_t &var, int32_t value) { return var = value; }
atomic_set(volatile uint32_t & var,uint32_t value)37     inline uint32_t atomic_set(volatile uint32_t &var, uint32_t value) { return var = value; }
atomic_set(volatile int32_t * var,int32_t value)38     inline int32_t atomic_set(volatile int32_t *var, int32_t value) { return *var = value; }
atomic_set(volatile uint32_t * var,uint32_t value)39     inline uint32_t atomic_set(volatile uint32_t *var, uint32_t value) { return *var = value; }
40 
41 }
42 
43 
44 #endif /* TAMGAMP_LV2_ATOMIC_H_ */
45