src/macros.h
changeset 7828 ac69a695d506
parent 7827 c7f4246a6356
child 7829 062bc42baf63
equal deleted inserted replaced
7827:c7f4246a6356 7828:ac69a695d506
   414 
   414 
   415 /**
   415 /**
   416  * Clear the first bit in an integer.
   416  * Clear the first bit in an integer.
   417  *
   417  *
   418  * This function returns a value where the first bit (from LSB)
   418  * This function returns a value where the first bit (from LSB)
   419  * is cleared. This function checks, similar to FindFirstBit2x64,
   419  * is cleared. This function checks only the bits of 0x3F3F!
   420  * the bits at 0x3F3F.
       
   421  *
   420  *
   422  * @param value The value to clear the first bit
   421  * @param value The value to clear the first bit
   423  * @return The new value with the first bit cleared
   422  * @return The new value with the first bit cleared
   424  * @see KILL_FIRST_BIT
       
   425  * @see FindFirstBit2x64
       
   426  */
   423  */
   427 static inline int KillFirstBit2x64(int value)
   424 static inline int KillFirstBit2x64(int value)
   428 {
   425 {
   429 	if (GB(value, 0, 8) == 0) {
   426 	return value &= (int)(value - 1) | 0x3FFFC0C0;
   430 		return KILL_FIRST_BIT(GB(value, 8, 6)) << 8;
       
   431 	} else {
       
   432 		return value & (KILL_FIRST_BIT(GB(value, 0, 6)) | 0x3F00);
       
   433 	}
       
   434 }
   427 }
   435 
   428 
   436 /**
   429 /**
   437  * Counts the number of set bits in a variable.
   430  * Counts the number of set bits in a variable.
   438  *
   431  *