Commit 4f233c43 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix missing 64 bit Solaris atomic prototypes

parent 106bb165
...@@ -60,6 +60,18 @@ my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set) ...@@ -60,6 +60,18 @@ my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set)
return ret; return ret;
} }
STATIC_INLINE int
my_atomic_cas64(int64 volatile *a, int64 *cmp, int64 set)
{
int ret;
int64 sav;
sav = (int64) atomic_cas_64((volatile uint64_t *)a, (uint64_t)*cmp,
(uint64_t)set);
if (! (ret = (sav == *cmp)))
*cmp = sav;
return ret;
}
STATIC_INLINE int STATIC_INLINE int
my_atomic_casptr(void * volatile *a, void **cmp, void *set) my_atomic_casptr(void * volatile *a, void **cmp, void *set)
{ {
...@@ -97,6 +109,14 @@ my_atomic_add32(int32 volatile *a, int32 v) ...@@ -97,6 +109,14 @@ my_atomic_add32(int32 volatile *a, int32 v)
return (nv - v); return (nv - v);
} }
STATIC_INLINE int64
my_atomic_add64(int64 volatile *a, int64 v)
{
int64 nv;
nv = atomic_add_64_nv((volatile uint64_t *)a, v);
return (nv - v);
}
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
#ifdef MY_ATOMIC_MODE_DUMMY #ifdef MY_ATOMIC_MODE_DUMMY
...@@ -110,6 +130,9 @@ my_atomic_load16(int16 volatile *a) { return (*a); } ...@@ -110,6 +130,9 @@ my_atomic_load16(int16 volatile *a) { return (*a); }
STATIC_INLINE int32 STATIC_INLINE int32
my_atomic_load32(int32 volatile *a) { return (*a); } my_atomic_load32(int32 volatile *a) { return (*a); }
STATIC_INLINE int64
my_atomic_load64(int64 volatile *a) { return (*a); }
STATIC_INLINE void * STATIC_INLINE void *
my_atomic_loadptr(void * volatile *a) { return (*a); } my_atomic_loadptr(void * volatile *a) { return (*a); }
...@@ -124,6 +147,9 @@ my_atomic_store16(int16 volatile *a, int16 v) { *a = v; } ...@@ -124,6 +147,9 @@ my_atomic_store16(int16 volatile *a, int16 v) { *a = v; }
STATIC_INLINE void STATIC_INLINE void
my_atomic_store32(int32 volatile *a, int32 v) { *a = v; } my_atomic_store32(int32 volatile *a, int32 v) { *a = v; }
STATIC_INLINE void
my_atomic_store64(int64 volatile *a, int64 v) { *a = v; }
STATIC_INLINE void STATIC_INLINE void
my_atomic_storeptr(void * volatile *a, void *v) { *a = v; } my_atomic_storeptr(void * volatile *a, void *v) { *a = v; }
...@@ -149,6 +175,12 @@ my_atomic_load32(int32 volatile *a) ...@@ -149,6 +175,12 @@ my_atomic_load32(int32 volatile *a)
return ((int32) atomic_or_32_nv((volatile uint32_t *)a, 0)); return ((int32) atomic_or_32_nv((volatile uint32_t *)a, 0));
} }
STATIC_INLINE int64
my_atomic_load64(int64 volatile *a)
{
return ((int64) atomic_or_64_nv((volatile uint64_t *)a, 0));
}
STATIC_INLINE void * STATIC_INLINE void *
my_atomic_loadptr(void * volatile *a) my_atomic_loadptr(void * volatile *a)
{ {
...@@ -175,6 +207,12 @@ my_atomic_store32(int32 volatile *a, int32 v) ...@@ -175,6 +207,12 @@ my_atomic_store32(int32 volatile *a, int32 v)
(void) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v); (void) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v);
} }
STATIC_INLINE void
my_atomic_store64(int64 volatile *a, int64 v)
{
(void) atomic_swap_64((volatile uint64_t *)a, (uint64_t)v);
}
STATIC_INLINE void STATIC_INLINE void
my_atomic_storeptr(void * volatile *a, void *v) my_atomic_storeptr(void * volatile *a, void *v)
{ {
...@@ -203,6 +241,12 @@ my_atomic_fas32(int32 volatile *a, int32 v) ...@@ -203,6 +241,12 @@ my_atomic_fas32(int32 volatile *a, int32 v)
return ((int32) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v)); return ((int32) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v));
} }
STATIC_INLINE int64
my_atomic_fas64(int64 volatile *a, int64 v)
{
return ((int64) atomic_swap_64((volatile uint64_t *)a, (uint64_t)v));
}
STATIC_INLINE void * STATIC_INLINE void *
my_atomic_fasptr(void * volatile *a, void *v) my_atomic_fasptr(void * volatile *a, void *v)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment