Antti Haapala added the comment: There is no need to ifdef anything, the memcpy is the only correct way to do it. As memcpy is also a reserved identifier in C, the compiler can and will optimize this into a 64-bit access on those platforms where it can be safely done so (x86 for example), e.g. GCC compiles
uint64_t func(char *buf) { uint64_t rv; memcpy(&rv, buf+3, sizeof(rv)); return rv; } into movq 3(%rdi), %rax ret On Linux 64-bit ABI. ---------- nosy: +ztane _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28055> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com