Define opal_int128_t type if a 128-bit integer is available.
There currently is no standard support for 128-bit integer types. Any use of the __int128 and int128_t types can lead to warnings from the compiler when using -Wpedantic. Additionally, some compilers may support __int128 and other may support int128_t. This commit addresses both issues by defining opal_int128_t if there is a supported 128-bit type. In the case of GCC a pragma has been added to suppress warnings about __int128 not being a standard C type.
Этот коммит содержится в:
родитель
b2b58b31a2
Коммит
b1632dfb3c
@ -122,10 +122,10 @@ static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
|
|||||||
#define opal_atomic_cmpset_acq_64 opal_atomic_cmpset_64
|
#define opal_atomic_cmpset_acq_64 opal_atomic_cmpset_64
|
||||||
#define opal_atomic_cmpset_rel_64 opal_atomic_cmpset_64
|
#define opal_atomic_cmpset_rel_64 opal_atomic_cmpset_64
|
||||||
|
|
||||||
#if OPAL_GCC_INLINE_ASSEMBLY && OPAL_HAVE_CMPXCHG16B && HAVE___INT128
|
#if OPAL_GCC_INLINE_ASSEMBLY && OPAL_HAVE_CMPXCHG16B && HAVE_OPAL_INT128_T
|
||||||
|
|
||||||
static inline __int128 opal_atomic_cmpset_128 (volatile __int128 *addr, __int128 oldval,
|
static inline opal_int128_t opal_atomic_cmpset_128 (volatile opal_int128_t *addr, opal_int128_t oldval,
|
||||||
__int128 newval)
|
opal_int128_t newval)
|
||||||
{
|
{
|
||||||
unsigned char ret;
|
unsigned char ret;
|
||||||
|
|
||||||
|
@ -49,10 +49,7 @@
|
|||||||
#include "opal_config.h"
|
#include "opal_config.h"
|
||||||
|
|
||||||
#include "opal/sys/architecture.h"
|
#include "opal/sys/architecture.h"
|
||||||
|
#include "opal_stdint.h"
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* do some quick #define cleanup in cases where we are doing
|
/* do some quick #define cleanup in cases where we are doing
|
||||||
testing... */
|
testing... */
|
||||||
|
@ -134,6 +134,33 @@ typedef unsigned long long uint64_t;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* 128-bit */
|
||||||
|
|
||||||
|
#ifdef HAVE_INT128_T
|
||||||
|
|
||||||
|
typedef int128_t opal_int128_t;
|
||||||
|
typedef uint128_t opal_uint128_t;
|
||||||
|
|
||||||
|
#define HAVE_OPAL_INT128_T 1
|
||||||
|
|
||||||
|
#elif HAVE___INT128
|
||||||
|
|
||||||
|
/* suppress warning about __int128 type */
|
||||||
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||||
|
typedef __int128 opal_int128_t;
|
||||||
|
|
||||||
|
/* suppress warning about __int128 type */
|
||||||
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||||
|
typedef unsigned __int128 opal_uint128_t;
|
||||||
|
|
||||||
|
#define HAVE_OPAL_INT128_T 1
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define HAVE_OPAL_INT128_T 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Pointers */
|
/* Pointers */
|
||||||
|
|
||||||
#if SIZEOF_VOID_P == SIZEOF_INT
|
#if SIZEOF_VOID_P == SIZEOF_INT
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user