aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/pint.h18
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))