fix a performance issue
This commit is contained in:
parent
1c1f9a4566
commit
a9894d8a03
1 changed files with 2 additions and 1 deletions
|
@ -906,7 +906,8 @@ pub fn str_to_mega_radix(stack: &mut Stack) -> OError {
|
|||
pub fn mega_to_str_radix(stack: &mut Stack) -> OError {
|
||||
require_int_on_stack!(radix, stack, "mega-to-str-radix");
|
||||
require_on_stack!(mega, Mega, stack, "mega-to-str-radix");
|
||||
let mut result = Vec::new();
|
||||
// capacity because O(n)
|
||||
let mut result = Vec::with_capacity((mega as f64).powf(1.0 / radix as f64) as usize + 2);
|
||||
let neg = mega < 0;
|
||||
let mut mega = mega;
|
||||
if neg {
|
||||
|
|
Loading…
Add table
Reference in a new issue