mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Use bitwise operators for ROUND_UP/DOWN and rename them
to ROUND_UP_POW2/ROUND_DOWN_POW2 svn path=/trunk/; revision=13585
This commit is contained in:
parent
14f94bc26a
commit
1217e4a19d
1 changed files with 4 additions and 4 deletions
|
@ -49,8 +49,8 @@
|
||||||
#define REG_EXTEND_HASH_TABLE_SIZE 4
|
#define REG_EXTEND_HASH_TABLE_SIZE 4
|
||||||
#define REG_VALUE_LIST_CELL_MULTIPLE 4
|
#define REG_VALUE_LIST_CELL_MULTIPLE 4
|
||||||
|
|
||||||
#define ROUND_DOWN(N, S) ((N) - ((N) % (S)))
|
#define ROUND_UP_POW2(N,S) (((N) + (S) - 1) & ~((S) - 1))
|
||||||
#define ROUND_UP(N, S) ROUND_DOWN((N) + (S) - 1, (S))
|
#define ROUND_DOWN_POW2(N,S) ((N) & ~((S) - 1))
|
||||||
|
|
||||||
#define ABS_VALUE(V) (((V) < 0) ? -(V) : (V))
|
#define ABS_VALUE(V) (((V) < 0) ? -(V) : (V))
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ CmiCreateDefaultRootKeyCell(PKEY_CELL RootKeyCell, PCHAR KeyName)
|
||||||
|
|
||||||
BaseKeyName = strrchr(KeyName, '\\') + 1;
|
BaseKeyName = strrchr(KeyName, '\\') + 1;
|
||||||
NameSize = strlen(BaseKeyName);
|
NameSize = strlen(BaseKeyName);
|
||||||
CellSize = ROUND_UP(sizeof(KEY_CELL) + NameSize - 1, 16);
|
CellSize = ROUND_UP_POW2(sizeof(KEY_CELL) + NameSize - 1, 16);
|
||||||
|
|
||||||
memset (RootKeyCell, 0, CellSize);
|
memset (RootKeyCell, 0, CellSize);
|
||||||
RootKeyCell->CellSize = (ULONG)-(LONG)CellSize;
|
RootKeyCell->CellSize = (ULONG)-(LONG)CellSize;
|
||||||
|
@ -786,7 +786,7 @@ CmiAllocateCell (PREGISTRY_HIVE RegistryHive,
|
||||||
*Block = NULL;
|
*Block = NULL;
|
||||||
|
|
||||||
/* Round to 16 bytes multiple */
|
/* Round to 16 bytes multiple */
|
||||||
CellSize = ROUND_UP(CellSize, 16);
|
CellSize = ROUND_UP_POW2(CellSize, 16);
|
||||||
|
|
||||||
/* first search in free blocks */
|
/* first search in free blocks */
|
||||||
NewBlock = NULL;
|
NewBlock = NULL;
|
||||||
|
|
Loading…
Reference in a new issue