~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/atomic/sun_studio.h

  • Committer: mordred
  • Date: 2009-07-15 05:28:57 UTC
  • mto: (1093.1.16 captain)
  • mto: This revision was merged to the branch mainline in revision 1097.
  • Revision ID: mordred@orisndriz02-20090715052857-fyizopg1m23l8vfo
pandora-build v0.18
Added support for ICC

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <atomic.h>
25
25
#undef _KERNEL
26
26
 
27
 
inline bool __sync_add_and_fetch(volatile bool* ptr, bool val)
28
 
{
29
 
  (val == true) ? atomic_inc_8((volatile uint8_t *)ptr) : atomic_add_8((volatile uint8_t *)ptr, (int8_t)val);
30
 
  return *ptr;
31
 
}
32
 
 
33
 
inline int8_t __sync_add_and_fetch(volatile int8_t* ptr, int8_t val)
34
 
{
35
 
  (val == 1) ? atomic_inc_8((volatile uint8_t*)ptr) : atomic_add_8((volatile uint8_t*)ptr, val);
36
 
  return *ptr;
37
 
}
38
 
 
39
 
inline int16_t __sync_add_and_fetch(volatile int16_t* ptr, int16_t val)
40
 
{
41
 
  (val == 1) ? atomic_inc_16((volatile uint16_t*)ptr) : atomic_add_16((volatile uint16_t*)ptr, val);
42
 
  return *ptr;
43
 
}
44
 
 
45
 
inline int32_t __sync_add_and_fetch(volatile int32_t* ptr, int32_t val)
46
 
{
47
 
  (val == 1) ? atomic_inc_32((volatile uint32_t*)ptr) : atomic_add_32((volatile uint32_t*)ptr, val);
48
 
  return *ptr;
49
 
}
50
 
 
51
27
inline uint8_t __sync_add_and_fetch(volatile uint8_t* ptr, uint8_t val)
52
28
{
53
29
  (val == 1) ? atomic_inc_8(ptr) : atomic_add_8(ptr, (int8_t)val);
72
48
  (val == 1) ? atomic_inc_64(ptr) : atomic_add_64(ptr, (int64_t)val);
73
49
  return *ptr;
74
50
}
75
 
 
76
 
inline int64_t __sync_add_and_fetch(volatile int64_t* ptr, int64_t val)
77
 
{
78
 
  (val == 1) ? atomic_inc_64((volatile uint64_t*)ptr) : atomic_add_64((volatile uint64_t*)ptr, val);
79
 
  return *ptr;
80
 
}
81
51
# endif /* defined(_KERNEL) || defined(_INT64_TYPE) */
82
52
 
83
53
 
105
75
  (val == 1) ? atomic_dec_64(ptr) : atomic_add_64(ptr, 0-(int64_t)val);
106
76
  return *ptr;
107
77
}
108
 
inline int64_t __sync_sub_and_fetch(volatile int64_t* ptr, uint64_t val)
109
 
{
110
 
  (val == 1) ? atomic_dec_64((volatile uint64_t *) ptr) : atomic_add_64((volatile uint64_t *) ptr, 0-(int64_t)val);
111
 
  return *ptr;
112
 
}
113
78
# endif /* defined(_KERNEL) || defined(_INT64_TYPE) */
114
79
 
 
80
 
115
81
inline uint8_t __sync_lock_test_and_set(volatile uint8_t* ptr, uint8_t val)
116
82
{
117
83
  atomic_swap_8(ptr, val);
138
104
}
139
105
#endif /* defined(_KERNEL) || defined(_INT64_TYPE) */
140
106
 
141
 
inline int8_t __sync_val_compare_and_swap(volatile int8_t* ptr,
142
 
                                           int8_t old_val, int8_t val)
143
 
{
144
 
  atomic_cas_8((volatile uint8_t *)ptr, old_val, val);
145
 
  return *ptr;
146
 
}
147
 
 
148
107
inline uint8_t __sync_val_compare_and_swap(volatile uint8_t* ptr,
149
108
                                           uint8_t old_val, uint8_t val)
150
109
{
175
134
}
176
135
#endif /* defined(_KERNEL) || defined(_INT64_TYPE) */
177
136
 
178
 
#endif /* DRIZZLED_ATOMIC_SUN_STUDIO_H */
 
137
 
 
138
#endif /* DRIZZLED_ATOMIC_SOLARIS_H */