mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Added extra checks of 64-bit atomic support on GCC and Solaris, also added 64-bit support in solaris.h which was missing
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2008 MySQL AB
|
||||
/* Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -60,6 +60,18 @@ my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set)
|
||||
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
|
||||
my_atomic_casptr(void * volatile *a, void **cmp, void *set)
|
||||
{
|
||||
@@ -97,6 +109,14 @@ my_atomic_add32(int32 volatile *a, int32 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
|
||||
@@ -110,6 +130,9 @@ my_atomic_load16(int16 volatile *a) { return (*a); }
|
||||
STATIC_INLINE int32
|
||||
my_atomic_load32(int32 volatile *a) { return (*a); }
|
||||
|
||||
STATIC_INLINE int64
|
||||
my_atomic_load64(int64 volatile *a) { return (*a); }
|
||||
|
||||
STATIC_INLINE void *
|
||||
my_atomic_loadptr(void * volatile *a) { return (*a); }
|
||||
|
||||
@@ -124,6 +147,9 @@ my_atomic_store16(int16 volatile *a, int16 v) { *a = v; }
|
||||
STATIC_INLINE void
|
||||
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
|
||||
my_atomic_storeptr(void * volatile *a, void *v) { *a = v; }
|
||||
|
||||
@@ -149,6 +175,12 @@ my_atomic_load32(int32 volatile *a)
|
||||
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 *
|
||||
my_atomic_loadptr(void * volatile *a)
|
||||
{
|
||||
@@ -175,6 +207,12 @@ my_atomic_store32(int32 volatile *a, int32 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
|
||||
my_atomic_storeptr(void * volatile *a, void *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));
|
||||
}
|
||||
|
||||
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 *
|
||||
my_atomic_fasptr(void * volatile *a, void *v)
|
||||
{
|
||||
|
Reference in New Issue
Block a user