Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
_atomic-mipspro.h
Go to the documentation of this file.
1
33# include <mutex.h>
34
35#define _RWSTD_NO_CHAR_ATOMIC_OPS
36#define _RWSTD_NO_SHORT_ATOMIC_OPS
37#define _RWSTD_NO_LLONG_ATOMIC_OPS
38
40
41inline unsigned
42__rw_atomic_preincrement (unsigned &__x, bool)
43{
44 return __add_then_test32 (&__x, 1U);
45}
46
47
48inline int
49__rw_atomic_preincrement (int &__x, bool)
50{
51 return __rw_atomic_preincrement (_RWSTD_REINTERPRET_CAST (unsigned&, __x),
52 false);
53}
54
55
56inline unsigned
57__rw_atomic_predecrement (unsigned &__x, bool)
58{
59 return __add_then_test32 (&__x, unsigned (-1));
60}
61
62
63inline int
64__rw_atomic_predecrement (int &__x, bool)
65{
66 return __rw_atomic_predecrement (_RWSTD_REINTERPRET_CAST (unsigned &, __x),
67 false);
68}
69
70
71inline unsigned
72__rw_atomic_exchange (unsigned &__x, unsigned __y, bool)
73{
74 return __test_and_set32 (&__x, __y);
75}
76
77
78inline int
79__rw_atomic_exchange (int &__x, int __y, bool)
80{
81 return __rw_atomic_exchange (_RWSTD_REINTERPRET_CAST (unsigned int&, __x),
82 _RWSTD_STATIC_CAST (unsigned int, __y), false);
83}
84
85
86# if _RWSTD_INT_SIZE < _RWSTD_LONG_SIZE
87
88inline unsigned long
89__rw_atomic_preincrement (unsigned long &__x, bool)
90{
91 return __add_then_test (&__x, 1);
92}
93
94
95inline long
96__rw_atomic_preincrement (long &__x, bool)
97{
98 return __rw_atomic_preincrement (_RWSTD_REINTERPRET_CAST(unsigned long&,
99 __x),
100 false);
101}
102
103inline unsigned long
104__rw_atomic_predecrement (unsigned long &__x, bool)
105{
106 return __add_then_test (&__x, -1);
107}
108
109
110inline long
111__rw_atomic_predecrement (long &__x, bool)
112{
113 return __rw_atomic_predecrement (_RWSTD_REINTERPRET_CAST (unsigned long&,
114 __x),
115 false);
116}
117
118
119inline unsigned long
120__rw_atomic_exchange (unsigned long &__x, unsigned long __y, bool)
121{
122 return __test_and_set (&__x, __y);
123}
124
125
126inline long
127__rw_atomic_exchange (long &__x, long __y, bool)
128{
129 return __rw_atomic_exchange (_RWSTD_REINTERPRET_CAST (unsigned long&, __x),
130 _RWSTD_STATIC_CAST (unsigned long, __y),
131 false);
132}
133
134# else // _RWSTD_INT_SIZE == _RWSTD_LONG_SIZE
135# define _RWSTD_NO_LONG_ATOMIC_OPS
136# endif // _RWSTD_INT_SIZE < _RWSTD_LONG_SIZE
137
138} // namespace __rw
#define _RWSTD_REINTERPRET_CAST(T, x)
Definition _defs.h:535
#define _RWSTD_STATIC_CAST(T, x)
Definition _defs.h:534
#define _RWSTD_NAMESPACE(name)
Definition _defs.h:567