xref: /haiku/src/tools/fs_shell/atomic.cpp (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
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 int32_t
14 fssh_atomic_set(vint32_t *value, int32_t newValue)
15 {
16 	return atomic_set((vint32*)value, newValue);
17 }
18 
19 
20 int32_t
21 fssh_atomic_test_and_set(vint32_t *value, int32_t newValue, int32_t testAgainst)
22 {
23 	return atomic_test_and_set((vint32*)value, newValue, testAgainst);
24 }
25 
26 
27 int32_t
28 fssh_atomic_add(vint32_t *value, int32_t addValue)
29 {
30 	return atomic_add((vint32*)value, addValue);
31 }
32 
33 
34 int32_t
35 fssh_atomic_and(vint32_t *value, int32_t andValue)
36 {
37 	return atomic_and((vint32*)value, andValue);
38 }
39 
40 
41 int32_t
42 fssh_atomic_or(vint32_t *value, int32_t orValue)
43 {
44 	return atomic_or((vint32*)value, orValue);
45 }
46 
47 
48 int32_t
49 fssh_atomic_get(vint32_t *value)
50 {
51 	return atomic_get((vint32*)value);
52 }
53 
54 
55 int64_t
56 fssh_atomic_set64(vint64_t *value, int64_t newValue)
57 {
58 	return atomic_set64((vint64*)value, newValue);
59 }
60 
61 
62 int64_t
63 fssh_atomic_test_and_set64(vint64_t *value, int64_t newValue, int64_t testAgainst)
64 {
65 	return atomic_test_and_set64((vint64 *)value, newValue, testAgainst);
66 }
67 
68 
69 int64_t
70 fssh_atomic_add64(vint64_t *value, int64_t addValue)
71 {
72 	return atomic_add64((vint64*)value, addValue);
73 }
74 
75 
76 int64_t
77 fssh_atomic_and64(vint64_t *value, int64_t andValue)
78 {
79 	return atomic_and64((vint64*)value, andValue);
80 }
81 
82 
83 int64_t
84 fssh_atomic_or64(vint64_t *value, int64_t orValue)
85 {
86 	return atomic_or64((vint64*)value, orValue);
87 }
88 
89 
90 int64_t
91 fssh_atomic_get64(vint64_t *value)
92 {
93 	return atomic_get64((vint64*)value);
94 }
95 
96