(svn r2924) Introduce the ALIGN() macro which aligns values to multiples of a power of 2, for exact semantics see the commment in macros.h

This commit is contained in:
tron
2005-09-08 12:48:26 +00:00
parent d73d12ae8a
commit 45ca3b6336
5 changed files with 12 additions and 6 deletions

View File

@@ -158,6 +158,12 @@ static inline void swap_tile(TileIndex *a, TileIndex *b) { TileIndex t = *a; *a
#define ROL(x, n) ((x) << (n) | (x) >> (sizeof(x) * 8 - (n)))
#define ROR(x, n) ((x) >> (n) | (x) << (sizeof(x) * 8 - (n)))
/**
* Return the smallest multiple of n equal or greater than x
* @note n must be a power of 2
*/
#define ALIGN(x, n) (((x) + (n) - 1) & ~((n) - 1))
/* IS_INT_INSIDE = filter for ascii-function codes like BELL and so on [we need an special filter here later] */
static inline bool IsValidAsciiChar(byte key)
{