File diff r6490:ba88f1f6bfd1 → r6491:6b6c19f090e1
src/macros.h
Show inline comments
 
@@ -82,9 +82,9 @@ template<typename T> static inline T TOG
 

	
 

	
 
/* checking more bits. Maybe unneccessary, but easy to use */
 
#define HASBITS(x,y) ((x) & (y))
 
#define SETBITS(x,y) ((x) |= (y))
 
#define CLRBITS(x,y) ((x) &= ~(y))
 
#define HASBITS(x, y) ((x) & (y))
 
#define SETBITS(x, y) ((x) |= (y))
 
#define CLRBITS(x, y) ((x) &= ~(y))
 

	
 
#define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START)
 
#define PLAYER_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_player_colors[owner]))
 
@@ -98,7 +98,7 @@ extern const byte _ffb_64[128];
 
/* Returns x with the first bit that is not zero, counted from the left, set
 
 * to zero. So, 10110100 returns 10110000, 00000001 returns 00000000, etc.
 
 */
 
#define KILL_FIRST_BIT(x) _ffb_64[(x)+64]
 
#define KILL_FIRST_BIT(x) _ffb_64[(x) + 64]
 

	
 
static inline int FindFirstBit2x64(int value)
 
{
 
@@ -133,13 +133,13 @@ static inline int KillFirstBit2x64(int v
 
#define HAS_SINGLE_BIT(a) ( ((a) & ((a) - 1)) == 0)
 

	
 
/* [min,max), strictly less than */
 
#define IS_BYTE_INSIDE(a,min,max) ((byte)((a)-(min)) < (byte)((max)-(min)))
 
#define IS_INT_INSIDE(a,min,max) ((uint)((a)-(min)) < (uint)((max)-(min)))
 
#define IS_BYTE_INSIDE(a, min, max) ((byte)((a) - (min)) < (byte)((max) - (min)))
 
#define IS_INT_INSIDE(a, min, max) ((uint)((a) - (min)) < (uint)((max) - (min)))
 

	
 

	
 
#define CHANCE16(a,b) ((uint16)Random() <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16R(a,b,r) ((uint16)(r=Random()) <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16(a, b) ((uint16)Random() <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16R(a, b, r) ((uint16)(r = Random()) <= (uint16)((65536 * (a)) / (b)))
 
#define CHANCE16I(a, b, v) ((uint16)(v) <= (uint16)((65536 * (a)) / (b)))
 

	
 

	
 
#define for_each_bit(_i, _b)            \