From db7f78ae462ec4b48a9bd0c383c35923d7581429 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Wed, 25 Oct 2017 10:01:22 +0200 Subject: [PATCH] don't use unaligned access on ARM --- asyncpg/protocol/hton.pxd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/asyncpg/protocol/hton.pxd b/asyncpg/protocol/hton.pxd index 89ca506e..219d837b 100644 --- a/asyncpg/protocol/hton.pxd +++ b/asyncpg/protocol/hton.pxd @@ -5,7 +5,7 @@ # the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0 -from libc.stdint cimport int16_t, int32_t, uint16_t, uint32_t, int64_t, uint64_t +from libc.stdint cimport uint8_t, int16_t, int32_t, uint16_t, uint32_t, int64_t, uint64_t IF UNAME_SYSNAME == "Windows": @@ -35,7 +35,10 @@ cdef inline void pack_int32(char* buf, int32_t x): cdef inline int32_t unpack_int32(const char* buf): - return ntohl((buf)[0]) + cdef uint32_t hh = (buf)[0] + hh = (hh << 8) | (buf)[1] + hh = (hh << 8) | (buf)[2] + return ((hh << 8) | (buf)[3]) cdef inline void pack_int64(char* buf, int64_t x):