Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-05-25 13:34:02 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-05-30 13:25:20 +0300
commit7b9a0ed8c47dfef03e8b21cafae3b5438bc93415 (patch)
treebad2c70c6b18602babbd0ebffc89b41edcdb7361 /source/blender/blenlib
parent08d325805f0c55e69ee0bfa6e17325afa753354a (diff)
BLI: Utils: Add Macro that compute the number of digits in integers type.
Usefull if you want to create char chains to contains hashes of a certain type.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_utildefines.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 75ddb5e739c..9c90b86832a 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -629,6 +629,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