From 13f21206a64de13202cec3c2841a8c3654b6899a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 2 Dec 2024 10:03:01 +0100 Subject: [PATCH] Call the serialize_into_writer method from the serialize_into one --- .../roaring_bitmap/cbo_roaring_bitmap_codec.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/crates/milli/src/heed_codec/roaring_bitmap/cbo_roaring_bitmap_codec.rs b/crates/milli/src/heed_codec/roaring_bitmap/cbo_roaring_bitmap_codec.rs index cae1874dd..20a246dcd 100644 --- a/crates/milli/src/heed_codec/roaring_bitmap/cbo_roaring_bitmap_codec.rs +++ b/crates/milli/src/heed_codec/roaring_bitmap/cbo_roaring_bitmap_codec.rs @@ -27,18 +27,8 @@ impl CboRoaringBitmapCodec { } } - pub fn serialize_into(roaring: &RoaringBitmap, vec: &mut Vec) { - if roaring.len() <= THRESHOLD as u64 { - // If the number of items (u32s) to encode is less than or equal to the threshold - // it means that it would weigh the same or less than the RoaringBitmap - // header, so we directly encode them using ByteOrder instead. - for integer in roaring { - vec.write_u32::(integer).unwrap(); - } - } else { - // Otherwise, we use the classic RoaringBitmapCodec that writes a header. - roaring.serialize_into(vec).unwrap(); - } + pub fn serialize_into_vec(roaring: &RoaringBitmap, vec: &mut Vec) { + Self::serialize_into_writer(roaring, vec).unwrap() } pub fn serialize_into_writer(