mirror of
https://github.com/loro-dev/loro.git
synced 2024-11-28 17:41:49 +00:00
fix: remove needless check
This commit is contained in:
parent
dc4229d609
commit
90fe4cc69e
2 changed files with 6 additions and 1 deletions
|
@ -477,6 +477,7 @@ impl<'bump, T: Rle, A: RleTreeTrait<T>> LeafNode<'bump, T, A> {
|
|||
ans
|
||||
}
|
||||
|
||||
// TODO: refactor
|
||||
pub(crate) fn apply_updates<F>(
|
||||
&mut self,
|
||||
mut updates: Vec<(usize, SmallVec<[T; 4]>)>,
|
||||
|
@ -506,6 +507,7 @@ impl<'bump, T: Rle, A: RleTreeTrait<T>> LeafNode<'bump, T, A> {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: try merging here?
|
||||
Ok(A::update_cache_leaf(self))
|
||||
} else {
|
||||
let mut new_children: SmallVec<[_; 64]> = SmallVec::new();
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
/// distribute the num to a array, where the sum of the array is num
|
||||
/// and each element is in the range [min, max]
|
||||
pub(super) fn distribute(mut num: usize, min: usize, max: usize) -> Vec<usize> {
|
||||
debug_assert!(num >= min);
|
||||
if num <= max {
|
||||
return vec![num];
|
||||
}
|
||||
|
||||
let n = num / min;
|
||||
let mut arr = vec![min; n];
|
||||
num -= n * min;
|
||||
|
|
Loading…
Reference in a new issue