値を表現するために必要な最小のbit幅 (bit_width)
(src/utility/bit/bit-width.hpp)
bit_width
n
を表現するために必要な最小のビット幅を求める。
$n = 0$ のときは $0$ が返る。
計算量
制約
C++20 以降では std::bit_width(T n)
を使用すること。
appendix
立っている bit のうち最も大きい桁よりも小さい bit をすべて 1 で埋め、popcount
でその数を取得している。
Depends on
Required by
Verified with
Code
Back to top page