Skip to content

Commit 32238cb

Browse files
committed
double check _Py_IS_ALIGNED()
1 parent c8fb961 commit 32238cb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Include/cpython/pyatomic.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,9 @@ _Py_atomic_load_ssize_acquire(const Py_ssize_t *obj);
552552
static inline void *
553553
_Py_atomic_memcpy_ptr_store_relaxed(void *dest, void *src, size_t n)
554554
{
555+
assert(_Py_IS_ALIGNED(dest, sizeof(void *)));
556+
assert(_Py_IS_ALIGNED(src, sizeof(void *)));
557+
assert(n % sizeof(void *) == 0);
555558
return memcpy(dest, src, n);
556559
// assert(((uintptr_t)dest & (sizeof (void *) - 1)) == 0);
557560
// assert(((uintptr_t)src & (sizeof (void *) - 1)) == 0);
@@ -573,6 +576,9 @@ _Py_atomic_memcpy_ptr_store_relaxed(void *dest, void *src, size_t n)
573576
static inline void *
574577
_Py_atomic_memmove_ptr_store_relaxed(void *dest, void *src, size_t n)
575578
{
579+
assert(_Py_IS_ALIGNED(dest, sizeof(void *)));
580+
assert(_Py_IS_ALIGNED(src, sizeof(void *)));
581+
assert(n % sizeof(void *) == 0);
576582
return memmove(dest, src, n);
577583
// assert(((uintptr_t)dest & (sizeof (void *) - 1)) == 0);
578584
// assert(((uintptr_t)src & (sizeof (void *) - 1)) == 0);

0 commit comments

Comments
 (0)