diff --git a/roaring/src/bitmap/container.rs b/roaring/src/bitmap/container.rs index b72965c5..4017eaab 100644 --- a/roaring/src/bitmap/container.rs +++ b/roaring/src/bitmap/container.rs @@ -42,6 +42,7 @@ impl Container { self.store.is_empty() } + #[inline] pub fn insert(&mut self, index: u16) -> bool { if self.store.insert(index) { self.ensure_correct_store(); diff --git a/roaring/src/bitmap/inherent.rs b/roaring/src/bitmap/inherent.rs index 559b7579..b2919b4c 100644 --- a/roaring/src/bitmap/inherent.rs +++ b/roaring/src/bitmap/inherent.rs @@ -48,6 +48,7 @@ impl RoaringBitmap { /// assert_eq!(rb.insert(3), false); /// assert_eq!(rb.contains(3), true); /// ``` + #[inline] pub fn insert(&mut self, value: u32) -> bool { let (key, index) = util::split(value); let container = match self.containers.binary_search_by_key(&key, |c| c.key) { diff --git a/roaring/src/bitmap/store/array_store/mod.rs b/roaring/src/bitmap/store/array_store/mod.rs index 883db31f..e252caba 100644 --- a/roaring/src/bitmap/store/array_store/mod.rs +++ b/roaring/src/bitmap/store/array_store/mod.rs @@ -47,6 +47,7 @@ impl ArrayStore { } } + #[inline] pub fn insert(&mut self, index: u16) -> bool { self.vec.binary_search(&index).map_err(|loc| self.vec.insert(loc, index)).is_err() } diff --git a/roaring/src/bitmap/store/bitmap_store.rs b/roaring/src/bitmap/store/bitmap_store.rs index 14a97cc7..7a181e3f 100644 --- a/roaring/src/bitmap/store/bitmap_store.rs +++ b/roaring/src/bitmap/store/bitmap_store.rs @@ -52,6 +52,7 @@ impl BitmapStore { } } + #[inline] pub fn insert(&mut self, index: u16) -> bool { let (key, bit) = (key(index), bit(index)); let old_w = self.bits[key]; diff --git a/roaring/src/bitmap/store/mod.rs b/roaring/src/bitmap/store/mod.rs index 71d981a2..bc46c532 100644 --- a/roaring/src/bitmap/store/mod.rs +++ b/roaring/src/bitmap/store/mod.rs @@ -50,6 +50,7 @@ impl Store { Store::Bitmap(BitmapStore::full()) } + #[inline] pub fn insert(&mut self, index: u16) -> bool { match self { Array(vec) => vec.insert(index),