Skip to content

Commit

Permalink
add init data
Browse files Browse the repository at this point in the history
  • Loading branch information
tickbh committed Sep 12, 2024
1 parent 277899f commit d28ccb9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["algorithm-macro"]

[package]
name = "algorithm"
version = "0.1.9"
version = "0.1.10"
edition = "2021"
authors = ["tickbh <[email protected]>"]
description = "about algorithm data structure, now has ttl with lru/lru-k/lfu/arc and slab/rbtree/roaring_bitmap/timer_wheelss, 关于算法常用的数据结构"
Expand Down
7 changes: 7 additions & 0 deletions src/buf/binary_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ impl BinaryMut {
}
}

pub fn data_mut(&mut self) -> &mut [u8] {
if self.wpos + 128 < self.vec.capacity() {
self.reserve(128);
}
&mut self.vec[self.wpos..]
}

#[inline]
pub unsafe fn try_resort_memory(&mut self) {
if self.vec.len() < self.resort || self.cursor < self.resort / 2 {
Expand Down

0 comments on commit d28ccb9

Please sign in to comment.