Math helper macros. More...
Math helper macros.
Definition in file math.h.
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
| #define | SIGNOF(a) |
Returns the sign of a, either -1 or 1. More... | |
| #define | DIV_ROUND(a, b) ((SIGNOF(a) * ((SIGNOF(a) * (a)) + (SIGNOF(b) * (b)) / 2) / (b))) |
Calculates a/ b with arithmetic rounding (.5 away from zero) | |
| #define | DIV_ROUND_UP(a, b) |
Calculates a/ b, always rounding up (towards positive infinity) More... | |
| #define | DIV_ROUND_INF(a, b) (SIGNOF(a) * (((SIGNOF(a) * (a)) + (SIGNOF(b) * (b)) - 1) / (b))) |
Calculates a/ b, always rounding away from zero (towards positive and negative inf) | |
| #define | MATH_ALIGN(num, chunk) ((chunk) * DIV_ROUND_INF(num, chunk)) |
Align num with the next multiple of chunk. | |
| #define DIV_ROUND_UP | ( | a, | |
| b | |||
| ) |
Calculates a/ b, always rounding up (towards positive infinity)