forked from mirror/OpenTTD
(svn r13639) -Codechange: rewrite 32bpp-anim and 32bpp-optimized drawing and encoding so it uses similiar scheme as 8bpp-optimized
All zoom levels are stored and a kind of RLE is used. Together with further changes and reducing number of variables, drawing is ~50% faster in average.
This commit is contained in:
@@ -101,8 +101,28 @@ static FORCEINLINE T abs(const T a)
|
||||
template <typename T>
|
||||
static FORCEINLINE T Align(const T x, uint n)
|
||||
{
|
||||
assert((n & (n - 1)) == 0 && n != 0);
|
||||
n--;
|
||||
return (T)((x + n) & ~(n));
|
||||
return (T)((x + n) & ~((T)n));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the smallest multiple of n equal or greater than x
|
||||
* Applies to pointers only
|
||||
*
|
||||
* @note n must be a power of 2
|
||||
* @param x The min value
|
||||
* @param n The base of the number we are searching
|
||||
* @return The smallest multiple of n equal or greater than x
|
||||
* @see Align()
|
||||
*/
|
||||
|
||||
assert_compile(sizeof(size_t) == sizeof(void *));
|
||||
|
||||
template <typename T>
|
||||
static FORCEINLINE T *AlignPtr(T *x, uint n)
|
||||
{
|
||||
return (T *)Align((size_t)x, n);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user