summaryrefslogtreecommitdiffstats
path: root/src/include/k5-platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/k5-platform.h')
-rw-r--r--src/include/k5-platform.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index 876335f94d..27f85846ac 100644
--- a/src/include/k5-platform.h
+++ b/src/include/k5-platform.h
@@ -39,6 +39,8 @@
#define K5_PLATFORM_H
#include "autoconf.h"
+/* for memcpy */
+#include <string.h>
/* Initialization and finalization function support for libraries.
@@ -655,6 +657,28 @@ load_64_le (const unsigned char *p)
#endif
}
+static inline unsigned short
+load_16_n (const unsigned char *p)
+{
+ uint16_t n;
+ memcpy(&n, p, 2);
+ return n;
+}
+static inline unsigned int
+load_32_n (const unsigned char *p)
+{
+ uint32_t n;
+ memcpy(&n, p, 4);
+ return n;
+}
+static inline UINT64_TYPE
+load_64_n (const unsigned char *p)
+{
+ UINT64_TYPE n;
+ memcpy(&n, p, 8);
+ return n;
+}
+
/* Make the interfaces to getpwnam and getpwuid consistent.
Model the wrappers on the POSIX thread-safe versions, but
use the unsafe system versions if the safe ones don't exist