diff options
author | Julien Staub <atsju2@yahoo.fr> | 2018-07-02 14:34:28 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2018-07-02 15:52:26 +0000 |
commit | 4572b77148828d87e1eab2aadd8dafa4549d7146 (patch) | |
tree | cf45ca1c768855d65851b788b7f092910b817316 /wsutil | |
parent | 53e04b621caa00c5cd5641d2fb8eb7e2783f85bd (diff) |
WSUTIL: create phtole32 and 64 functions
Change-Id: I15c3c40665ccab1e60057837ffce5bae50d1b52c
Reviewed-on: https://code.wireshark.org/review/28567
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/pint.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/wsutil/pint.h b/wsutil/pint.h index 72c67e4a48..f81f9713c7 100644 --- a/wsutil/pint.h +++ b/wsutil/pint.h @@ -135,6 +135,24 @@ static inline void phton64(guint8 *p, guint64 v) { p[7] = (guint8)(v >> 0); } +static inline void phtole32(guint8 *p, guint32 v) { + p[0] = (guint8)(v >> 0); + p[1] = (guint8)(v >> 8); + p[2] = (guint8)(v >> 16); + p[3] = (guint8)(v >> 24); +} + +static inline void phtole64(guint8 *p, guint64 v) { + p[0] = (guint8)(v >> 0); + p[1] = (guint8)(v >> 8); + p[2] = (guint8)(v >> 16); + p[3] = (guint8)(v >> 24); + p[4] = (guint8)(v >> 32); + p[5] = (guint8)(v >> 40); + p[6] = (guint8)(v >> 48); + p[7] = (guint8)(v >> 56); +} + /* Subtract two guint32s with respect to wraparound */ #define guint32_wraparound_diff(higher, lower) ((higher>lower)?(higher-lower):(higher+0xffffffff-lower+1)) |