summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-11-04 18:28:52 +0000
committertruelight <truelight@openttd.org>2007-11-04 18:28:52 +0000
commitadc4ab55402f1ada916e72bb1b57706fc38d78d0 (patch)
tree83930f61aee5acc7461dd511cd7ed293dd345419 /src
parente983210f5e53a71b9501731a4dcf1390312360f5 (diff)
downloadopenttd-adc4ab55402f1ada916e72bb1b57706fc38d78d0.tar.xz
(svn r11378) -Codechange: optimize KillFirstBit2x64 (skidd13)
Diffstat (limited to 'src')
-rw-r--r--src/macros.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/macros.h b/src/macros.h
index ea7fc32db..e4b7bf203 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -416,21 +416,14 @@ Faster ( or at least cleaner ) implementation below?
* Clear the first bit in an integer.
*
* This function returns a value where the first bit (from LSB)
- * is cleared. This function checks, similar to FindFirstBit2x64,
- * the bits at 0x3F3F.
+ * is cleared. This function checks only the bits of 0x3F3F!
*
* @param value The value to clear the first bit
* @return The new value with the first bit cleared
- * @see KILL_FIRST_BIT
- * @see FindFirstBit2x64
*/
static inline int KillFirstBit2x64(int value)
{
- if (GB(value, 0, 8) == 0) {
- return KILL_FIRST_BIT(GB(value, 8, 6)) << 8;
- } else {
- return value & (KILL_FIRST_BIT(GB(value, 0, 6)) | 0x3F00);
- }
+ return value &= (int)(value - 1) | 0x3FFFC0C0;
}
/**