Skip to content

Commit 67a9897

Browse files
committed
replace bit_ceil
1 parent 4121285 commit 67a9897

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

atcoder/internal_bit.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,29 @@
55
#include <intrin.h>
66
#endif
77

8+
#if __cplusplus >= 202002L
9+
#include <bit>
10+
#endif
11+
812
namespace atcoder {
913

1014
namespace internal {
1115

16+
#if __cplusplus >= 202002L
17+
18+
using std::bit_ceil;
19+
20+
#else
21+
1222
// @return same with std::bit::bit_ceil
1323
unsigned int bit_ceil(unsigned int n) {
1424
unsigned int x = 1;
1525
while (x < (unsigned int)(n)) x *= 2;
1626
return x;
1727
}
1828

29+
#endif
30+
1931
// @param n `1 <= n`
2032
// @return same with std::bit::countr_zero
2133
int countr_zero(unsigned int n) {

0 commit comments

Comments
 (0)