summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-02-04 17:42:53 -0500
committermidipix <writeonce@midipix.org>2017-02-05 18:31:03 -0500
commit5c48f617d99f6d4788bed5fb6d52a31de7c534ae (patch)
treefe64a233d922b7389814f6881c48c438a22c8f24 /src
parente4625f4def03f960088b19eff184d019a5ead8a1 (diff)
downloadmdso-5c48f617d99f6d4788bed5fb6d52a31de7c534ae.tar.bz2
mdso-5c48f617d99f6d4788bed5fb6d52a31de7c534ae.tar.xz
internals: added little endian object generation helper functions.
Diffstat (limited to 'src')
-rw-r--r--src/internal/mdso_object_impl.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/internal/mdso_object_impl.h b/src/internal/mdso_object_impl.h
new file mode 100644
index 0000000..b329ef9
--- /dev/null
+++ b/src/internal/mdso_object_impl.h
@@ -0,0 +1,33 @@
+/****************************************************************/
+/* mdso: midipix dso scavenger */
+/* Copyright (C) 2015--2017 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.MDSO. */
+/****************************************************************/
+
+#include <stdint.h>
+
+static inline void mdso_obj_write_short(unsigned char * ch, uint16_t val)
+{
+ ch[0] = val;
+ ch[1] = val >> 8;
+}
+
+static inline void mdso_obj_write_long(unsigned char * ch, uint32_t val)
+{
+ ch[0] = val;
+ ch[1] = val >> 8;
+ ch[2] = val >> 16;
+ ch[3] = val >> 24;
+}
+
+static inline void mdso_obj_write_quad(unsigned char * ch, uint64_t val)
+{
+ ch[0] = val;
+ ch[1] = val >> 8;
+ ch[2] = val >> 16;
+ ch[3] = val >> 24;
+ ch[4] = val >> 32;
+ ch[5] = val >> 40;
+ ch[6] = val >> 48;
+ ch[7] = val >> 56;
+}