[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / language.support / support.limits / limits / numeric.limits.members / digits.pass.cpp
blob4608a3d01ba1470342cd397d94f1cde172d35941
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // test numeric_limits
11 // digits
13 #include <limits>
14 #include <cfloat>
16 #include "test_macros.h"
18 template <class T, int expected>
19 void
20 test()
22 static_assert(std::numeric_limits<T>::digits == expected, "digits test 1");
23 static_assert(std::numeric_limits<const T>::digits == expected, "digits test 2");
24 static_assert(std::numeric_limits<volatile T>::digits == expected, "digits test 3");
25 static_assert(std::numeric_limits<const volatile T>::digits == expected, "digits test 4");
28 int main(int, char**)
30 test<bool, 1>();
31 test<char, std::numeric_limits<char>::is_signed ? 7 : 8>();
32 test<signed char, 7>();
33 test<unsigned char, 8>();
34 test<wchar_t, std::numeric_limits<wchar_t>::is_signed ? sizeof(wchar_t)*8-1 : sizeof(wchar_t)*8>();
35 #if TEST_STD_VER > 17 && defined(__cpp_char8_t)
36 test<char8_t, 8>();
37 #endif
38 test<char16_t, 16>();
39 test<char32_t, 32>();
40 test<short, 15>();
41 test<unsigned short, 16>();
42 test<int, 31>();
43 test<unsigned int, 32>();
44 test<long, sizeof(long) == 4 ? 31 : 63>();
45 test<unsigned long, sizeof(long) == 4 ? 32 : 64>();
46 test<long long, 63>();
47 test<unsigned long long, 64>();
48 #ifndef TEST_HAS_NO_INT128
49 test<__int128_t, 127>();
50 test<__uint128_t, 128>();
51 #endif
52 test<float, FLT_MANT_DIG>();
53 test<double, DBL_MANT_DIG>();
54 test<long double, LDBL_MANT_DIG>();
56 return 0;