mirror of
https://github.com/uutils/coreutils.git
synced 2025-12-23 08:47:37 +00:00
seq: calculate number length more efficiently
This commit is contained in:
parent
499f056972
commit
f026b7a3ad
1 changed files with 2 additions and 2 deletions
|
|
@ -290,8 +290,8 @@ fn fast_print_seq(
|
|||
// Format the first number.
|
||||
let first_str = first.to_string();
|
||||
|
||||
// Makeshift log10.ceil
|
||||
let last_length = last.to_string().len();
|
||||
// Approximate length of the last number in base 10.
|
||||
let last_length = (last.bits() as f64 / std::f64::consts::LOG2_10).ceil() as usize;
|
||||
|
||||
// Allocate a large u8 buffer, that contains a preformatted string
|
||||
// of the number followed by the `separator`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue