summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-03-09 19:23:59 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-03-09 19:23:59 +0000
commitcb675ad06252e16b752529fff29d19a1100eda9f (patch)
treebce54b13dc7fa8c1f16de23a5f7ad069c07ad335 /lib
parentbdbdf51a0085c4b1de92aad472cbf0fb2ead7ba8 (diff)
downloadcoreutils-cb675ad06252e16b752529fff29d19a1100eda9f.tar.xz
(TYPE_SIGNED): Remove.
(INT_STRLEN_BOUND): Switch to same implementation as intprops.h.
Diffstat (limited to 'lib')
-rw-r--r--lib/strftime.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/strftime.c b/lib/strftime.c
index 6d742f265..8085a5992 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -120,15 +120,12 @@ extern char *tzname[];
? (a) >> (b) \
: (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
-#define TYPE_SIGNED(t) ((t) -1 < 0)
-
-/* Bound on length of the string representing an integer value of type t.
- Subtract one for the sign bit if t is signed;
- 302 / 1000 is log10 (2) rounded up;
- add one for integer division truncation;
- add one more for a minus sign if t is signed. */
+/* Bound on length of the string representing an integer value or type T.
+ Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485;
+ add 1 for integer division truncation; add 1 more for a minus sign
+ if needed. */
#define INT_STRLEN_BOUND(t) \
- ((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 + 1 + TYPE_SIGNED (t))
+ ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2)
#define TM_YEAR_BASE 1900