Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Avoid unaligned load
  • Loading branch information
encukou committed Dec 18, 2024
commit 5155293361de5db6abe76b50a6510452441e4fb7
5 changes: 4 additions & 1 deletion Modules/_ctypes/cfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ Py_ssize_t NUM_BITS(Py_ssize_t bitsize) {
return NULL; \
} \
} \
*(CTYPE*)ptr = SET(CTYPE, *(CTYPE*)ptr, val, size_arg); \
CTYPE prev; \
memcpy(&prev, ptr, (NBITS) / 8); \
val = SET(CTYPE, prev, val, size_arg); \
memcpy(ptr, &val, (NBITS) / 8); \
_RET(value); \
} \
\
Expand Down