Skip to content

Commit e6d3e5c

Browse files
committed
#include <assert.h>
1 parent c2de542 commit e6d3e5c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Include/cpython/pyatomic.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
# error "this header file must not be included directly"
8888
#endif
8989

90+
#include <assert.h>
91+
9092
// --- _Py_atomic_add --------------------------------------------------------
9193
// Atomically adds `value` to `obj` and returns the previous value
9294

@@ -550,12 +552,9 @@ _Py_atomic_load_ssize_acquire(const Py_ssize_t *obj);
550552
static inline void *
551553
_Py_atomic_memcpy_ptr_store_relaxed(void *dest, void *src, size_t n)
552554
{
553-
// XXX: The assertions below currently fail on Android ARM build.
554-
// In fact, assert(1 == 1) fails on that build.
555-
556-
// assert(((uintptr_t)dest & (uintptr_t)(sizeof (void *) - 1)) == 0);
557-
// assert(((uintptr_t)src & (uintptr_t)(sizeof (void *) - 1)) == 0);
558-
// assert(n % (size_t)sizeof(void *) == 0);
555+
assert(((uintptr_t)dest & (uintptr_t)(sizeof (void *) - 1)) == 0);
556+
assert(((uintptr_t)src & (uintptr_t)(sizeof (void *) - 1)) == 0);
557+
assert(n % (size_t)sizeof(void *) == 0);
559558

560559
if (dest != src) {
561560
void **dest_ = (void **)dest;
@@ -573,9 +572,9 @@ _Py_atomic_memcpy_ptr_store_relaxed(void *dest, void *src, size_t n)
573572
static inline void *
574573
_Py_atomic_memmove_ptr_store_relaxed(void *dest, void *src, size_t n)
575574
{
576-
// assert(((uintptr_t)dest & (uintptr_t)(sizeof (void *) - 1)) == 0);
577-
// assert(((uintptr_t)src & (uintptr_t)(sizeof (void *) - 1)) == 0);
578-
// assert(n % (size_t)sizeof(void *) == 0);
575+
assert(((uintptr_t)dest & (uintptr_t)(sizeof (void *) - 1)) == 0);
576+
assert(((uintptr_t)src & (uintptr_t)(sizeof (void *) - 1)) == 0);
577+
assert(n % (size_t)sizeof(void *) == 0);
579578

580579
if (dest < src || dest >= (void *)((char *)src + n)) {
581580
void **dest_ = (void **)dest;

0 commit comments

Comments
 (0)