mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r11390) -Fix r11387: AB() was wrong (spotted by Rafal Rzepecki, patch by skidd13)
This commit is contained in:
parent
4e518e3ceb
commit
87295922cf
@ -66,9 +66,8 @@ template<typename T, typename U> static inline T SB(T& x, const uint8 s, const u
|
|||||||
*/
|
*/
|
||||||
template<typename T, typename U> static inline T AB(T& x, const uint8 s, const uint8 n, const U i)
|
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);
|
const T mask = (T)(((1U << n) - 1) << s);
|
||||||
x &= ~tmp;
|
x = (T)((x & ~mask) | ((x + (i << s)) & mask));
|
||||||
x |= (T)((x + (i << s)) & tmp);
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user