1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: CC0-1.0
// SPDX-FileCopyrightText: Authored by Tsukasa OI <floss_ssdeep@irq.a4lg.com> in 2023, 2024
//! Various internal utilities.
/// Computes the base-2 logarithm (floored) of an [`u64`] value.
///
/// This is the wrapper with fallbacks for stable [`u64::ilog2()`].
///
/// # Development Notes (TODO)
///
/// It will be `const` once MSRV of 1.57 is acceptable.
///
/// Consider removing it once MSRV of 1.67 is acceptable.
pub
/// Computes the lowest `n` bits of ones and return as an [`u64`] value.
///
/// Note that this function will only check the validity of `n`
/// on the debug build.
///
/// # Development Notes (TODO)
///
/// It will be `const` once MSRV of 1.57 is acceptable.
pub