summary refs log tree commit diff
path: root/shorttypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'shorttypes.h')
-rw-r--r--shorttypes.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/shorttypes.h b/shorttypes.h
new file mode 100644
index 0000000..7b2df58
--- /dev/null
+++ b/shorttypes.h
@@ -0,0 +1,36 @@
+#ifndef SHORTTYPES_H
+#define SHORTTYPES_H
+#include <limits.h>
+
+#if CHAR_BIT != 8
+	#error "CHAR_BIT != 8"
+#endif
+
+#if USHRT_MAX != 65535
+	#error "USHRT_MAX != 65535"
+#endif
+
+#if UINT_MAX != 4294967295U
+	#error "UINT_MAX != 4294967295U"
+#endif
+
+typedef   signed char  s8;
+typedef   signed short s16;
+typedef   signed int   s32;
+typedef unsigned char  u8;
+typedef unsigned short u16;
+typedef unsigned int   u32;
+
+#ifdef ULLONG_MAX
+	#if ULLONG_MAX == 18446744073709551615ULL
+		typedef   signed long long s64;
+		typedef unsigned long long u64;
+	#else
+		#error "ULLONG_MAX != 18446744073709551615ULL"
+	#endif
+#else
+	#error "no long long type"
+#endif
+
+
+#endif /* SHORTTYPES_H */