Calculate exact capacity needed for hash
This commit is contained in:
parent
e1c57d1930
commit
e5efa1e4f8
|
@ -358,11 +358,11 @@ impl Encoder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut blurhash = String::with_capacity(30);
|
|
||||||
|
|
||||||
let (_, dc) = self.factors[0];
|
let (_, dc) = self.factors[0];
|
||||||
let ac = &self.factors[1..];
|
let ac = &self.factors[1..];
|
||||||
|
|
||||||
|
let mut blurhash = String::with_capacity(1 + 1 + 4 + 2 * ac.len());
|
||||||
|
|
||||||
let size_flag = self.components.x - 1 + (self.components.y - 1) * 9;
|
let size_flag = self.components.x - 1 + (self.components.y - 1) * 9;
|
||||||
base83::encode(size_flag, 1, &mut blurhash);
|
base83::encode(size_flag, 1, &mut blurhash);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue