added functions for integer hash keys
[rocksndiamonds.git] / src / libgame / types.h
index 1278a553a6418c85f6ee2f1bde885f78ca8594fa..6ea71aeba0ed210e5458db15c2523414b03b8a7c 100644 (file)
@@ -4,7 +4,7 @@
 // (c) 1995-2014 by Artsoft Entertainment
 //                         Holger Schemel
 //                 info@artsoft.org
-//                 http://www.artsoft.org/
+//                 https://www.artsoft.org/
 // ----------------------------------------------------------------------------
 // types.h
 // ============================================================================
@@ -19,7 +19,7 @@
 #include <sys/types.h>
 
 
-#if !defined(PLATFORM_WIN32)
+#if !defined(PLATFORM_WINDOWS)
 typedef int boolean;
 typedef unsigned char byte;
 #endif
@@ -41,11 +41,11 @@ typedef unsigned char byte;
 #define AUTO           -1
 
 #ifndef MIN
-#define MIN(a,b)       ((a) < (b) ? (a) : (b))
+#define MIN(a, b)      ((a) < (b) ? (a) : (b))
 #endif
 
 #ifndef MAX
-#define MAX(a,b)       ((a) > (b) ? (a) : (b))
+#define MAX(a, b)      ((a) > (b) ? (a) : (b))
 #endif
 
 #ifndef ABS
@@ -64,8 +64,13 @@ typedef unsigned char byte;
 #define EVEN(a)                (((a) & 1) == 0)
 #endif
 
-#define SIZEOF_ARRAY(array, type)      (sizeof(array) / sizeof(type))
-#define SIZEOF_ARRAY_INT(array)                SIZEOF_ARRAY(array, int)
+#define ARRAY_SIZE(array)              (sizeof(array) / sizeof(array[0]))
+
+#define PTR_TO_INT(p)  ((int) (long) (p))
+#define PTR_TO_UINT(p) ((unsigned int) (unsigned long) (p))
+
+#define INT_TO_PTR(i)  ((void *) (long) (i))
+#define UINT_TO_PTR(u) ((void *) (unsigned long) (u))
 
 
 struct ListNode
@@ -77,4 +82,11 @@ struct ListNode
 };
 typedef struct ListNode ListNode;
 
-#endif /* TYPES_H */
+struct DelayCounter
+{
+  unsigned int value;
+  unsigned int count;
+};
+typedef struct DelayCounter DelayCounter;
+
+#endif // TYPES_H