src/macros.h
changeset 8005 2318a0547719
parent 7971 8509d595142a
equal deleted inserted replaced
8004:1c54bc6f4bdf 8005:2318a0547719
    18  * @param sprite The sprite to check
    18  * @param sprite The sprite to check
    19  * @return True if it is a new sprite, or false if it is original.
    19  * @return True if it is a new sprite, or false if it is original.
    20  */
    20  */
    21 #define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE)
    21 #define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE)
    22 
    22 
    23 
    23 /**
    24 #define for_each_bit(_i, _b)            \
    24  * Do an operation for each set set bit in a value.
    25 	for (_i = 0; _b != 0; _i++, _b >>= 1) \
    25  *
    26 		if (_b & 1)
    26  * This macros is used to do an operation for each set
       
    27  * bit in a variable. The first variable can be reused
       
    28  * in the operation due to it's the bit position counter.
       
    29  * The second variable will be cleared during the usage
       
    30  *
       
    31  * @param i The position counter
       
    32  * @param b The value which we check for set bits
       
    33  */
       
    34 #define FOR_EACH_SET_BIT(i, b)            \
       
    35 	for (i = 0; b != 0; i++, b >>= 1) \
       
    36 		if (b & 1)
    27 
    37 
    28 
    38 
    29 static inline uint16 ReadLE16Aligned(const void* x)
    39 static inline uint16 ReadLE16Aligned(const void* x)
    30 {
    40 {
    31 	return FROM_LE16(*(const uint16*)x);
    41 	return FROM_LE16(*(const uint16*)x);