summaryrefslogtreecommitdiffstats
path: root/src/Globals.h
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-03-09 19:47:22 +0100
committerTycho <work.tycho+git@gmail.com>2014-03-09 19:47:22 +0100
commit1bf99b5fd26d142106d7a097900ebfe8a6279ad4 (patch)
tree44b238f317fd6863758a77ea640995e11f7e691a /src/Globals.h
parentFixed Mesannine twister to use UInt32 (diff)
downloadcuberite-1bf99b5fd26d142106d7a097900ebfe8a6279ad4.tar
cuberite-1bf99b5fd26d142106d7a097900ebfe8a6279ad4.tar.gz
cuberite-1bf99b5fd26d142106d7a097900ebfe8a6279ad4.tar.bz2
cuberite-1bf99b5fd26d142106d7a097900ebfe8a6279ad4.tar.lz
cuberite-1bf99b5fd26d142106d7a097900ebfe8a6279ad4.tar.xz
cuberite-1bf99b5fd26d142106d7a097900ebfe8a6279ad4.tar.zst
cuberite-1bf99b5fd26d142106d7a097900ebfe8a6279ad4.zip
Diffstat (limited to 'src/Globals.h')
-rw-r--r--src/Globals.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/Globals.h b/src/Globals.h
index 98611fc55..b046e6db0 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -81,7 +81,7 @@
#endif
-
+#include <stddef.h>
// Integral types with predefined sizes:
@@ -96,8 +96,22 @@ typedef unsigned short UInt16;
typedef unsigned char Byte;
+// If you get an error about specialization check the size of integral types
+template <typename T, size_t Size, bool x = sizeof(T) == Size>
+class SizeChecker;
+
+template <typename T, size_t Size>
+class SizeChecker<T, Size, true> {
+ T v;
+};
+template class SizeChecker<Int64, 8>;
+template class SizeChecker<Int32, 4>;
+template class SizeChecker<Int16, 2>;
+template class SizeChecker<UInt64, 8>;
+template class SizeChecker<UInt32, 4>;
+template class SizeChecker<UInt16, 2>;
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for any class that shouldn't allow copying itself
@@ -179,7 +193,7 @@ typedef unsigned char Byte;
#include <memory>
#include <set>
#include <queue>
-
+#include <limits>