1 /* Test stdc_has_single_bit functions and macros.
2 Copyright (C) 2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <tst-stdbit.h>
21 static const struct stdbit_test inputs
[] =
23 { 0ULL, false, false, false, false },
24 { 0x1ULL
, true, true, true, true },
25 { 0x2ULL
, true, true, true, true },
26 { 0x3ULL
, false, false, false, false },
27 { 0x4ULL
, true, true, true, true },
28 { 0x5ULL
, false, false, false, false },
29 { 0x6ULL
, false, false, false, false },
30 { 0x7ULL
, false, false, false, false },
31 { 0x8ULL
, true, true, true, true },
32 { 0x9ULL
, false, false, false, false },
33 { 0xaULL
, false, false, false, false },
34 { 0xbULL
, false, false, false, false },
35 { 0xcULL
, false, false, false, false },
36 { 0xdULL
, false, false, false, false },
37 { 0xeULL
, false, false, false, false },
38 { 0xfULL
, false, false, false, false },
39 { 0x10ULL
, true, true, true, true },
40 { 0x11ULL
, false, false, false, false },
41 { 0x12ULL
, false, false, false, false },
42 { 0x1fULL
, false, false, false, false },
43 { 0x20ULL
, true, true, true, true },
44 { 0x7fULL
, false, false, false, false },
45 { 0x80ULL
, true, true, true, true },
46 { 0x81ULL
, false, false, false, false },
47 { 0x9aULL
, false, false, false, false },
48 { 0xf3ULL
, false, false, false, false },
49 { 0xffULL
, false, false, false, false },
50 { 0x100ULL
, false, true, true, true },
51 { 0x101ULL
, true, false, false, false },
52 { 0x102ULL
, true, false, false, false },
53 { 0x1feULL
, false, false, false, false },
54 { 0x1ffULL
, false, false, false, false },
55 { 0x200ULL
, false, true, true, true },
56 { 0x234ULL
, false, false, false, false },
57 { 0x4567ULL
, false, false, false, false },
58 { 0x7fffULL
, false, false, false, false },
59 { 0x8000ULL
, false, true, true, true },
60 { 0x8001ULL
, true, false, false, false },
61 { 0xfffeULL
, false, false, false, false },
62 { 0xffffULL
, false, false, false, false },
63 { 0x10000ULL
, false, false, true, true },
64 { 0x10001ULL
, true, true, false, false },
65 { 0xfedcba98ULL
, false, false, false, false },
66 { 0xfffffefeULL
, false, false, false, false },
67 { 0xffffffffULL
, false, false, false, false },
68 { 0x100000000ULL
, false, false, false, true },
69 { 0x100000001ULL
, true, true, true, false },
70 { 0x123456789ULL
, false, false, false, false },
71 { 0x123456789abcdefULL
, false, false, false, false },
72 { 0x789abcdef0123456ULL
, false, false, false, false },
73 { 0x8000000000000000ULL
, false, false, false, true },
74 { 0x8000000000000001ULL
, true, true, true, false },
75 { 0xfffffffffffffffeULL
, false, false, false, false },
76 { 0xffffffffffffffffULL
, false, false, false, false },
79 TEST_STDBIT_BOOL_TOPLEVEL (stdc_has_single_bit
);
84 TEST_STDBIT_BOOL (stdc_has_single_bit
, inputs
);
88 #include <support/test-driver.c>