xref: /aosp_15_r20/external/libwebm/webm_parser/src/bit_utils.h (revision 103e46e4cd4b6efcf6001f23fa8665fb110abf8d)
1 // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2 //
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS.  All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 #ifndef SRC_BIT_UTILS_H_
9 #define SRC_BIT_UTILS_H_
10 
11 #include <cstdint>
12 
13 namespace webm {
14 
15 // Counts the number of leading zero bits.
16 // For example:
17 //   assert(8 == CountLeadingZeros(0x00));
18 //   assert(4 == CountLeadingZeros(0x0f));
19 //   assert(0 == CountLeadingZeros(0xf0));
20 std::uint8_t CountLeadingZeros(std::uint8_t value);
21 
22 }  // namespace webm
23 
24 #endif  // SRC_BIT_UTILS_H_
25