summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 615781a465..edd785cb87 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -86,6 +86,29 @@ void tor_strlower(char *s)
}
}
+#ifndef UNALIGNED_ACCESS_OK
+uint16_t get_uint16(char *cp)
+{
+ uint16_t v;
+ memcpy(&v,cp,2);
+ return v;
+}
+uint32_t get_uint32(char *cp)
+{
+ uint32_t v;
+ memcpy(&v,cp,4);
+ return v;
+}
+void set_uint16(char *cp, uint16_t v)
+{
+ memcpy(cp,&v,2);
+}
+void set_uint32(char *cp, uint32_t v)
+{
+ memcpy(cp,&v,4);
+}
+#endif
+
/*
* A simple smartlist interface to make an unordered list of acceptable