From 6c07ee0ba39c869b5a092e1c5de698da976e6953 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Mon, 5 Aug 2013 20:14:20 -0700 Subject: added in_uint64_le --- common/parse.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'common/parse.h') diff --git a/common/parse.h b/common/parse.h index 226e246b..f92e76de 100644 --- a/common/parse.h +++ b/common/parse.h @@ -183,6 +183,31 @@ struct stream } while (0) #endif +/******************************************************************************/ +#if defined(B_ENDIAN) || defined(NEED_ALIGN) +#define in_uint64_le(s, v) do \ +{ \ + (v) = (tui64) \ + ( \ + (((tui64)(*((unsigned char*)((s)->p + 0)))) << 0) | \ + (((tui64)(*((unsigned char*)((s)->p + 1)))) << 8) | \ + (((tui64)(*((unsigned char*)((s)->p + 2)))) << 16) | \ + (((tui64)(*((unsigned char*)((s)->p + 3)))) << 24) | \ + (((tui64)(*((unsigned char*)((s)->p + 4)))) << 32) | \ + (((tui64)(*((unsigned char*)((s)->p + 5)))) << 40) | \ + (((tui64)(*((unsigned char*)((s)->p + 6)))) << 48) | \ + (((tui64)(*((unsigned char*)((s)->p + 7)))) << 56) \ + ); \ + (s)->p += 8; \ +} while (0) +#else +#define in_uint64_le(s, v) do \ +{ \ + (v) = *((tui64*)((s)->p)); \ + (s)->p += 8; \ +} while (0) +#endif + /******************************************************************************/ #define in_uint32_be(s, v) do \ { \ -- cgit v1.2.1