Skip to content

Commit 57dabd7

Browse files
committed
Add unpack_uint32 function
1 parent 3158dbb commit 57dabd7

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

hton.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ unpack_int32(const char *buf)
163163
return (int32_t)apg_ntoh32(nx);
164164
}
165165

166+
static inline uint32_t
167+
unpack_uint32(const char *buf)
168+
{
169+
uint32_t nx;
170+
memcpy((char *)&nx, buf, sizeof(uint32_t));
171+
return (uint32_t)apg_ntoh32(nx);
172+
}
173+
166174

167175
static inline int64_t
168176
unpack_int64(const char *buf)

hton.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ cdef extern from "./hton.h":
1616
cdef void pack_double(char *buf, double f);
1717
cdef int16_t unpack_int16(const char *buf);
1818
cdef int32_t unpack_int32(const char *buf);
19+
cdef uint32_t unpack_uint32(const char *buf);
1920
cdef int64_t unpack_int64(const char *buf);
2021
cdef float unpack_float(const char *buf);
2122
cdef double unpack_double(const char *buf);

0 commit comments

Comments
 (0)