1// constexpr test for boost/core/bit.hpp (bit_ceil)
2//
3// Copyright 2023 Peter Dimov
4// Distributed under the Boost Software License, Version 1.0.
5// https://www.boost.org/LICENSE_1_0.txt
6
7#include <boost/config.hpp>
8#include <boost/config/pragma_message.hpp>
9
10#if defined(BOOST_NO_CXX14_CONSTEXPR)
11
12BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_NO_CXX14_CONSTEXPR is defined" )
13
14#else
15
16#include <boost/core/bit.hpp>
17
18#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
19
20STATIC_ASSERT( boost::core::bit_ceil( (unsigned char)0x74 ) == 0x80 );
21STATIC_ASSERT( boost::core::bit_ceil( (unsigned short)0x7400 ) == 0x8000 );
22STATIC_ASSERT( boost::core::bit_ceil( 0x740000u ) == 0x800000u );
23STATIC_ASSERT( boost::core::bit_ceil( 0x74000000ul ) == 0x80000000ul );
24STATIC_ASSERT( boost::core::bit_ceil( 0x7400000000ull ) == 0x8000000000ull );
25
26#endif
27

source code of boost/libs/core/test/bit_ceil_test_cx.cpp