summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-05-30 19:52:51 -0600
committerKarl Williamson <khw@cpan.org>2020-07-17 22:22:09 -0600
commitab350cbd30297533ca6b5ad84e705bdccf1332d5 (patch)
tree44dd589c9080a1ba52154d25e4bfbb091af4a086 /handy.h
parentaae9ca421631baa3b79b7bb1d29eb19c22b02257 (diff)
downloadperl-ab350cbd30297533ca6b5ad84e705bdccf1332d5.tar.gz
handy.h: Add comments
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/handy.h b/handy.h
index 02ece2bb69..a2da312351 100644
--- a/handy.h
+++ b/handy.h
@@ -244,7 +244,10 @@ typedef U64TYPE U64;
#endif
/* log(2) (i.e., log base 10 of 2) is pretty close to 0.30103, just in case
- * anyone is grepping for it */
+ * anyone is grepping for it. So BIT_DIGITS gives the number of decimal digits
+ * required to represent any possible unsigned number containing N bits.
+ * TYPE_DIGITS gives the number of decimal digits required to represent any
+ * possible unsigned number of type T. */
#define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log10(2) =~ 146/485 */
#define TYPE_DIGITS(T) BIT_DIGITS(sizeof(T) * 8)
#define TYPE_CHARS(T) (TYPE_DIGITS(T) + 2) /* sign, NUL */