summaryrefslogtreecommitdiff
path: root/src/dmidecode/types.h
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2010-02-05 09:54:11 -0800
committerBob Gilligan <gilligan@vyatta.com>2010-02-05 09:54:11 -0800
commite1971e4774a6ebb5ed33a09bdd60afa2c0534b6f (patch)
treef4fc5aaccb4d9dac43ae7a825df9006532c1a059 /src/dmidecode/types.h
downloadvyatta-biosdevname-debian/0.1.tar.gz
vyatta-biosdevname-debian/0.1.zip
Initial commit.debian/0.1
Diffstat (limited to 'src/dmidecode/types.h')
-rw-r--r--src/dmidecode/types.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/dmidecode/types.h b/src/dmidecode/types.h
new file mode 100644
index 0000000..12f3c65
--- /dev/null
+++ b/src/dmidecode/types.h
@@ -0,0 +1,27 @@
+#ifndef TYPES_H
+#define TYPES_H
+
+#include "config.h"
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef signed short i16;
+typedef unsigned int u32;
+
+#ifdef ALIGNMENT_WORKAROUND
+# ifdef BIGENDIAN
+# define WORD(x) (u16)((x)[1]+((x)[0]<<8))
+# define DWORD(x) (u32)((x)[3]+((x)[2]<<8)+((x)[1]<<16)+((x)[0]<<24))
+# define QWORD(x) (U64(DWORD(x+4), DWORD(x)))
+# else /* BIGENDIAN */
+# define WORD(x) (u16)((x)[0]+((x)[1]<<8))
+# define DWORD(x) (u32)((x)[0]+((x)[1]<<8)+((x)[2]<<16)+((x)[3]<<24))
+# define QWORD(x) (U64(DWORD(x), DWORD(x+4)))
+# endif /* BIGENDIAN */
+#else /* ALIGNMENT_WORKAROUND */
+#define WORD(x) (u16)(*(const u16 *)(x))
+#define DWORD(x) (u32)(*(const u32 *)(x))
+#define QWORD(x) (*(const u64 *)(x))
+#endif /* ALIGNMENT_WORKAROUND */
+
+#endif