mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
du: use div_ceil() from std
This commit is contained in:
parent
c94b2e9105
commit
28e9a88077
1 changed files with 1 additions and 8 deletions
|
@ -555,7 +555,7 @@ impl StatPrinter {
|
|||
size,
|
||||
uucore::format::human::SizeFormat::Binary,
|
||||
),
|
||||
SizeFormat::BlockSize(block_size) => div_ceil(size, block_size).to_string(),
|
||||
SizeFormat::BlockSize(block_size) => size.div_ceil(block_size).to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,13 +576,6 @@ impl StatPrinter {
|
|||
}
|
||||
}
|
||||
|
||||
// This can be replaced with u64::div_ceil once it is stabilized.
|
||||
// This implementation approach is optimized for when `b` is a constant,
|
||||
// particularly a power of two.
|
||||
pub fn div_ceil(a: u64, b: u64) -> u64 {
|
||||
(a + b - 1) / b
|
||||
}
|
||||
|
||||
// Read file paths from the specified file, separated by null characters
|
||||
fn read_files_from(file_name: &str) -> Result<Vec<PathBuf>, std::io::Error> {
|
||||
let reader: Box<dyn BufRead> = if file_name == "-" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue