From f17692adaacc234f90db845e295946b5a68e511a Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Mon, 19 Aug 2013 10:47:26 -0700 Subject: [PATCH] added out_uint64_le --- common/parse.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/common/parse.h b/common/parse.h index f92e76de..3ec37104 100644 --- a/common/parse.h +++ b/common/parse.h @@ -278,6 +278,35 @@ struct stream } while (0) #endif +/******************************************************************************/ +#if defined(B_ENDIAN) || defined(NEED_ALIGN) +#define out_uint64_le(s, v) do \ +{ \ + *((s)->p) = (unsigned char)((v) >> 0); \ + (s)->p++; \ + *((s)->p) = (unsigned char)((v) >> 8); \ + (s)->p++; \ + *((s)->p) = (unsigned char)((v) >> 16); \ + (s)->p++; \ + *((s)->p) = (unsigned char)((v) >> 24); \ + (s)->p++; \ + *((s)->p) = (unsigned char)((v) >> 32); \ + (s)->p++; \ + *((s)->p) = (unsigned char)((v) >> 40); \ + (s)->p++; \ + *((s)->p) = (unsigned char)((v) >> 48); \ + (s)->p++; \ + *((s)->p) = (unsigned char)((v) >> 56); \ + (s)->p++; \ +} while (0) +#else +#define out_uint64_le(s, v) do \ +{ \ + *((tui64*)((s)->p)) = (v); \ + (s)->p += 8; \ +} while (0) +#endif + /******************************************************************************/ #define out_uint32_be(s, v) do \ { \