diff options
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 98c27bd053b..f81bfc2f853 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -274,11 +274,15 @@ extern "C" { #define SQUARE(a) ({ \ typeof(a) a_ = (a); \ ((a_) * (a_)); }) +#define CUBE(a) ({ \ + typeof(a) a_ = (a); \ + ((a_) * (a_) * (a_)); }) #else #define ABS(a) ((a) < 0 ? (-(a)) : (a)) #define SQUARE(a) ((a) * (a)) +#define CUBE(a) ((a) * (a) * (a)) #endif @@ -629,6 +633,14 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size); # define UNLIKELY(x) (x) #endif +/* Expands to an integer constant expression evaluating to a close upper bound + * on the number the number of decimal digits in a value expressible in the + * integer type given by the argument (if it is a type name) or the the integer + * type of the argument (if it is an expression). The meaning of the resulting + * expression is unspecified for other arguments. + * i.e: DECIMAL_DIGITS_BOUND(uchar) is equal to 3. */ +#define DECIMAL_DIGITS_BOUND(t) (241 * sizeof(t) / 100 + 1) + #ifdef __cplusplus } #endif |