[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/6] limits-h: add BOOL_MAX, BOOL_WIDTH
From: |
Bruno Haible |
Subject: |
Re: [PATCH 1/6] limits-h: add BOOL_MAX, BOOL_WIDTH |
Date: |
Sun, 01 Aug 2021 15:38:26 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; ) |
> + limits-h: add BOOL_MAX, BOOL_WIDTH
2021-08-01 Bruno Haible <bruno@clisp.org>
limits-h tests: Add tests for BOOL_MAX and BOOL_WIDTH.
* tests/test-limits-h.c (bool_attrs): New variable.
Check value of BOOL_MAX.
diff --git a/tests/test-limits-h.c b/tests/test-limits-h.c
index 4144013..f3394c1 100644
--- a/tests/test-limits-h.c
+++ b/tests/test-limits-h.c
@@ -110,6 +110,11 @@ verify_width (ULONG_WIDTH, 0, ULONG_MAX);
verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX);
verify_width (ULLONG_WIDTH, 0, ULLONG_MAX);
+/* Macros specified by C2x. */
+
+int bool_attrs[] = { BOOL_MAX, BOOL_WIDTH };
+verify (BOOL_MAX == (((1U << (BOOL_WIDTH - 1)) - 1) * 2) + 1);
+
int
main (void)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 1/6] limits-h: add BOOL_MAX, BOOL_WIDTH,
Bruno Haible <=