refactor(cli): move highbit policy leaf to Rust

Export FIO_highbit64 directly from Rust under the existing caller symbol and
remove the C forwarding wrapper. Preserve the nonzero-input contract and add
boundary tests for the scalar policy leaf.

Test Plan:
- capped nightly rustfmt check
- capped root clippy with all targets and -D warnings
- capped native make -j1
- capped upstream make -j1 -C tests test
- capped CLI clippy and 185 CLI tests

All integrated checks ran at the combined working-tree tip under a serial
40 GiB virtual-memory cap. Standalone root Rust unit linking remains
unavailable because the crate imports C-owned bridge symbols.
This commit is contained in:
2026-07-20 10:12:02 +02:00
parent 539608cac1
commit 9110af5f9e
2 changed files with 6 additions and 14 deletions
+4 -3
View File
@@ -1680,7 +1680,7 @@ fn highbit64(value: u64) -> c_uint {
}
#[no_mangle]
pub extern "C" fn FIO_rust_highbit64(value: u64) -> c_uint {
pub extern "C" fn FIO_highbit64(value: u64) -> c_uint {
highbit64(value)
}
@@ -3001,8 +3001,9 @@ mod tests {
#[test]
fn largest_file_size_scan_preserves_large_values_and_errors() {
assert_eq!(largest_file_size([0, 1u64 << 63, 7]), 1u64 << 63);
assert_eq!(FIO_rust_highbit64(1u64 << 63), 63);
assert_eq!(FIO_rust_highbit64(u64::MAX), 63);
assert_eq!(FIO_highbit64(1), 0);
assert_eq!(FIO_highbit64(1u64 << 63), 63);
assert_eq!(FIO_highbit64(u64::MAX), 63);
let missing_path = temporary_file_path("missing");
let missing = CString::new(missing_path.to_string_lossy().as_bytes()).unwrap();