Skip to content

Commit 616a694

Browse files
committed
Expect aligned pointer for the atomic operations
1 parent a74c385 commit 616a694

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ruby_atomic.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ rbimpl_atomic_load_relaxed(volatile rb_atomic_t *ptr)
3636
}
3737
#define ATOMIC_LOAD_RELAXED(var) rbimpl_atomic_load_relaxed(&(var))
3838

39+
typedef RBIMPL_ALIGNAS(sizeof(uint64_t)) uint64_t rbimpl_atomic_uint64_t;
40+
3941
static inline uint64_t
40-
rbimpl_atomic_u64_load_relaxed(const volatile uint64_t *value)
42+
rbimpl_atomic_u64_load_relaxed(const volatile rbimpl_atomic_uint64_t *value)
4143
{
4244
#if defined(HAVE_GCC_ATOMIC_BUILTINS_64)
4345
return __atomic_load_n(value, __ATOMIC_RELAXED);
@@ -54,7 +56,7 @@ rbimpl_atomic_u64_load_relaxed(const volatile uint64_t *value)
5456
#define ATOMIC_U64_LOAD_RELAXED(var) rbimpl_atomic_u64_load_relaxed(&(var))
5557

5658
static inline void
57-
rbimpl_atomic_u64_set_relaxed(volatile uint64_t *address, uint64_t value)
59+
rbimpl_atomic_u64_set_relaxed(volatile rbimpl_atomic_uint64_t *address, uint64_t value)
5860
{
5961
#if defined(HAVE_GCC_ATOMIC_BUILTINS_64)
6062
__atomic_store_n(address, value, __ATOMIC_RELAXED);

0 commit comments

Comments
 (0)