X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Ftypes.h;h=15b25ce8da23c4449a74e2506dc34bca1f0203a0;hb=edaa850fd2d2cae7ec31961fae3d56487e710c71;hp=5129f1c874d1131403bfb801425048a981bedb48;hpb=e89a21e95b3cb84d1515c0fb3378ce902a48c1c8;p=rocksndiamonds.git diff --git a/src/libgame/types.h b/src/libgame/types.h index 5129f1c8..15b25ce8 100644 --- a/src/libgame/types.h +++ b/src/libgame/types.h @@ -36,35 +36,43 @@ typedef unsigned char byte; #undef AUTO #endif -#define TRUE 1 -#define FALSE 0 -#define AUTO -1 +#define TRUE 1 +#define FALSE 0 +#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 -#define ABS(a) ((a) < 0 ? -(a) : (a)) +#define ABS(a) ((a) < 0 ? -(a) : (a)) #endif #ifndef SIGN -#define SIGN(a) ((a) < 0 ? -1 : ((a) > 0 ? 1 : 0)) +#define SIGN(a) ((a) < 0 ? -1 : ((a) > 0 ? 1 : 0)) #endif #ifndef ODD -#define ODD(a) (((a) & 1) == 1) +#define ODD(a) (((a) & 1) == 1) #endif #ifndef EVEN -#define EVEN(a) (((a) & 1) == 0) +#define EVEN(a) (((a) & 1) == 0) #endif -#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) +#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)) + +#define STRUCT_OFFSET(s, m) (offsetof(s, m)) struct ListNode