Changeset - r7840:98e152f4a802
[Not reviewed]
master
0 1 0
truelight - 17 years ago 2007-11-07 22:41:50
truelight@openttd.org
(svn r11390) -Fix r11387: AB() was wrong (spotted by Rafal Rzepecki, patch by skidd13)
1 file changed with 2 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/macros.h
Show inline comments
 
@@ -66,9 +66,8 @@ template<typename T, typename U> static 
 
 */
 
template<typename T, typename U> static inline T AB(T& x, const uint8 s, const uint8 n, const U i)
 
{
 
	const T tmp = (T)(((1U << n) - 1) << s);
 
	x &= ~tmp;
 
	x |= (T)((x + (i << s)) & tmp);
 
	const T mask = (T)(((1U << n) - 1) << s);
 
	x = (T)((x & ~mask) | ((x + (i << s)) & mask));
 
	return x;
 
}
 

	
0 comments (0 inline, 0 general)