Proper memory commitment
This commit is contained in:
+5
-4
@@ -107,6 +107,7 @@ typedef unsigned __int128 U128;
|
||||
#define AlignDownPow2(val, align) ((val) & ~((align) - 1UL))
|
||||
#define IsPow2(x) ((x) && !((x) & ((x) - 1UL)))
|
||||
#define IsPow2OrZero(x) (!((x) & ((x) - 1UL)))
|
||||
#define IsAlignedTo(x, y) (IsPow2(y) && !((x) & ((y) - 1UL)))
|
||||
|
||||
#define GetBit(val, idx) (((val) >> (idx)) & 1)
|
||||
// Get n_bits starting at idx going left
|
||||
@@ -132,7 +133,7 @@ typedef unsigned __int128 U128;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Round up x / y
|
||||
* Ceiling of X / y , or round up x / y
|
||||
* (e.g 100/9 == 12, 3/2 == 2)
|
||||
* x + y must not overflow.
|
||||
*
|
||||
@@ -140,7 +141,7 @@ typedef unsigned __int128 U128;
|
||||
* @param y denominator
|
||||
* @return x/y rounded up
|
||||
*/
|
||||
#define DivRoundUp(x, y) (((x) + ((y) - 1)) / (y))
|
||||
#define CeilDiv(x, y) (((x) + ((y) - 1)) / (y))
|
||||
|
||||
/**
|
||||
* Round x up to nearest multiple of y
|
||||
@@ -151,7 +152,7 @@ typedef unsigned __int128 U128;
|
||||
* @param y denominator
|
||||
* @return x rounded up to nearest multiple of y
|
||||
*/
|
||||
#define RoundUp(x, y) (DIV_ROUND_UP((x), (y)) * (y))
|
||||
#define RoundUpToMultiple(x, y) (CeilDiv((x), (y)) * (y))
|
||||
|
||||
/**
|
||||
* Round x down to nearest multiple of y
|
||||
@@ -162,7 +163,7 @@ typedef unsigned __int128 U128;
|
||||
* @param y denominator
|
||||
* @return x rounded down nearest multiple of y
|
||||
*/
|
||||
#define RoundDown(x, y) ((x) / (y) * (y))
|
||||
#define RounDownToMultiple(x, y) ((x) / (y) * (y))
|
||||
#define Clamp(val, min, max) (((val) < (min)) ? (min) : ((val) > (max)) ? (max) : (val))
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
Reference in New Issue
Block a user