1 /*
2 * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de.
3 * Distributed under the terms of the MIT License.
4 */
5
6 #include "compatibility.h"
7
8 #include <OS.h>
9
10 #include "fssh_atomic.h"
11
12
13 void
fssh_atomic_set(int32_t * value,int32_t newValue)14 fssh_atomic_set(int32_t* value, int32_t newValue)
15 {
16 atomic_set((int32*)value, newValue);
17 }
18
19
20 int32_t
fssh_atomic_get_and_set(int32_t * value,int32_t newValue)21 fssh_atomic_get_and_set(int32_t* value, int32_t newValue)
22 {
23 return atomic_get_and_set((int32*)value, newValue);
24 }
25
26
27 int32_t
fssh_atomic_test_and_set(int32_t * value,int32_t newValue,int32_t testAgainst)28 fssh_atomic_test_and_set(int32_t *value, int32_t newValue, int32_t testAgainst)
29 {
30 return atomic_test_and_set((int32*)value, newValue, testAgainst);
31 }
32
33
34 int32_t
fssh_atomic_add(int32_t * value,int32_t addValue)35 fssh_atomic_add(int32_t *value, int32_t addValue)
36 {
37 return atomic_add((int32*)value, addValue);
38 }
39
40
41 int32_t
fssh_atomic_and(int32_t * value,int32_t andValue)42 fssh_atomic_and(int32_t *value, int32_t andValue)
43 {
44 return atomic_and((int32*)value, andValue);
45 }
46
47
48 int32_t
fssh_atomic_or(int32_t * value,int32_t orValue)49 fssh_atomic_or(int32_t *value, int32_t orValue)
50 {
51 return atomic_or((int32*)value, orValue);
52 }
53
54
55 int32_t
fssh_atomic_get(int32_t * value)56 fssh_atomic_get(int32_t *value)
57 {
58 return atomic_get((int32*)value);
59 }
60
61
62 void
fssh_atomic_set64(int64_t * value,int64_t newValue)63 fssh_atomic_set64(int64_t *value, int64_t newValue)
64 {
65 atomic_set64((int64*)value, newValue);
66 }
67
68
69 int64_t
fssh_atomic_get_and_set64(int64_t * value,int64_t newValue)70 fssh_atomic_get_and_set64(int64_t* value, int64_t newValue)
71 {
72 return atomic_get_and_set64((int64*)value, newValue);
73 }
74
75
76 int64_t
fssh_atomic_test_and_set64(int64_t * value,int64_t newValue,int64_t testAgainst)77 fssh_atomic_test_and_set64(int64_t *value, int64_t newValue, int64_t testAgainst)
78 {
79 return atomic_test_and_set64((int64 *)value, newValue, testAgainst);
80 }
81
82
83 int64_t
fssh_atomic_add64(int64_t * value,int64_t addValue)84 fssh_atomic_add64(int64_t *value, int64_t addValue)
85 {
86 return atomic_add64((int64*)value, addValue);
87 }
88
89
90 int64_t
fssh_atomic_and64(int64_t * value,int64_t andValue)91 fssh_atomic_and64(int64_t *value, int64_t andValue)
92 {
93 return atomic_and64((int64*)value, andValue);
94 }
95
96
97 int64_t
fssh_atomic_or64(int64_t * value,int64_t orValue)98 fssh_atomic_or64(int64_t *value, int64_t orValue)
99 {
100 return atomic_or64((int64*)value, orValue);
101 }
102
103
104 int64_t
fssh_atomic_get64(int64_t * value)105 fssh_atomic_get64(int64_t *value)
106 {
107 return atomic_get64((int64*)value);
108 }
109
110