From 21151691d7592eab77b55ffb30c98ce8f638483f Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 5 Jun 2024 22:02:26 +0200 Subject: [PATCH] cpu/native: Fix C11 atomic sizes for musl musl and glibc have different types for fast atomic integers. This selects the correct size depending on the used library. --- cpu/native/include/c11_atomics_compat_cpu.hpp | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/cpu/native/include/c11_atomics_compat_cpu.hpp b/cpu/native/include/c11_atomics_compat_cpu.hpp index c83f32617a..d5a01a003a 100644 --- a/cpu/native/include/c11_atomics_compat_cpu.hpp +++ b/cpu/native/include/c11_atomics_compat_cpu.hpp @@ -63,24 +63,24 @@ #define ATOMIC_UINT_FAST8_T_SIZE (1U) #define ATOMIC_UINT_FAST8_T_SAME_SIZED_TYPE uint8_t #endif -#ifdef __x86_64__ -#define ATOMIC_INT_FAST16_T_SIZE (8U) -#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint64_t -#define ATOMIC_UINT_FAST16_T_SIZE (8U) -#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint64_t -#define ATOMIC_INT_FAST32_T_SIZE (8U) -#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint64_t -#define ATOMIC_UINT_FAST32_T_SIZE (8U) -#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint64_t +#if defined(__x86_64__) && defined(__GLIBC__) +# define ATOMIC_INT_FAST16_T_SIZE (8U) +# define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint64_t +# define ATOMIC_UINT_FAST16_T_SIZE (8U) +# define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint64_t +# define ATOMIC_INT_FAST32_T_SIZE (8U) +# define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint64_t +# define ATOMIC_UINT_FAST32_T_SIZE (8U) +# define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint64_t #else -#define ATOMIC_INT_FAST16_T_SIZE (4U) -#define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint32_t -#define ATOMIC_UINT_FAST16_T_SIZE (4U) -#define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint32_t -#define ATOMIC_INT_FAST32_T_SIZE (4U) -#define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t -#define ATOMIC_UINT_FAST32_T_SIZE (4U) -#define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t +# define ATOMIC_INT_FAST16_T_SIZE (4U) +# define ATOMIC_INT_FAST16_T_SAME_SIZED_TYPE uint32_t +# define ATOMIC_UINT_FAST16_T_SIZE (4U) +# define ATOMIC_UINT_FAST16_T_SAME_SIZED_TYPE uint32_t +# define ATOMIC_INT_FAST32_T_SIZE (4U) +# define ATOMIC_INT_FAST32_T_SAME_SIZED_TYPE uint32_t +# define ATOMIC_UINT_FAST32_T_SIZE (4U) +# define ATOMIC_UINT_FAST32_T_SAME_SIZED_TYPE uint32_t #endif #define ATOMIC_INT_FAST64_T_SIZE (8U) #define ATOMIC_INT_FAST64_T_SAME_SIZED_TYPE uint64_t