mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-17 23:44:22 +00:00
COMMON: Added a new IS_ALIGNED macro (for now using size_t, we can change it if this turns out to be not portable enough. Also added a doxygen comment to the ARRAYSIZE macro
svn-id: r39542
This commit is contained in:
parent
428b0ec800
commit
e59b4587b7
@ -793,7 +793,7 @@ void OSystem_SDL::copyRectToScreen(const byte *src, int pitch, int x, int y, int
|
||||
assert(h > 0 && y + h <= _videoMode.screenHeight);
|
||||
assert(w > 0 && x + w <= _videoMode.screenWidth);
|
||||
|
||||
if (((long)src & 3) == 0 && pitch == _videoMode.screenWidth && x == 0 && y == 0 &&
|
||||
if (IS_ALIGNED(src, 4) && pitch == _videoMode.screenWidth && x == 0 && y == 0 &&
|
||||
w == _videoMode.screenWidth && h == _videoMode.screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) {
|
||||
/* Special, optimized case for full screen updates.
|
||||
* It tries to determine what areas were actually changed,
|
||||
@ -997,7 +997,7 @@ void OSystem_SDL::makeChecksums(const byte *buf) {
|
||||
|
||||
void OSystem_SDL::addDirtyRgnAuto(const byte *buf) {
|
||||
assert(buf);
|
||||
assert(((long)buf & 3) == 0);
|
||||
assert(IS_ALIGNED(buf, 4));
|
||||
|
||||
/* generate a table of the checksums */
|
||||
makeChecksums(buf);
|
||||
|
@ -28,6 +28,15 @@
|
||||
#include "common/scummsys.h"
|
||||
#include "common/str.h"
|
||||
|
||||
|
||||
/**
|
||||
* Check whether a given pointer is aligned correctly.
|
||||
* Note that 'alignment' must be a power of two!
|
||||
*/
|
||||
#define IS_ALIGNED(value, alignment) \
|
||||
((((size_t)value) & ((alignment) - 1)) == 0)
|
||||
|
||||
|
||||
#ifdef MIN
|
||||
#undef MIN
|
||||
#endif
|
||||
@ -47,6 +56,9 @@ template<typename T> inline T CLIP (T v, T amin, T amax)
|
||||
*/
|
||||
template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }
|
||||
|
||||
/**
|
||||
* Macro which determines the number of entries in a fixed size array.
|
||||
*/
|
||||
#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user