Skip to content

Instantly share code, notes, and snippets.

@xyzz
Created December 2, 2012 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyzz/4188724 to your computer and use it in GitHub Desktop.
Save xyzz/4188724 to your computer and use it in GitHub Desktop.
+//! 64 bit unsigned variable.
+/** This is a typedef for unsigned long long, it ensures portability of the engine. */
+#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
+typedef unsigned __int64 u64;
+#elif defined(__GNUC__) && defined(__UINT64_TYPE__)
+typedef __UINT64_TYPE__ u64;
+#elif ULONG_MAX == 18446744073709551615u // 2**64 - 1
+typedef unsigned long u64;
+#else // Fallback
+// Works even without C++11 with any compiler known to me.
+typedef unsigned long long u64;
+#endif
+//! 64 bit signed variable.
+/** This is a typedef for signed long long, it ensures portability of the engine. */
+#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
+typedef __int64 s64;
+#elif defined(__GNUC__) && defined(__UINT64_TYPE__)
+typedef __INT64_TYPE__ s64;
+#elif ULONG_MAX == 18446744073709551615u // 2**64 - 1
+typedef signed long s64;
+#else // Fallback
+// Works even without C++11 with any compiler known to me.
+typedef signed long long s64;
+#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment