Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Oct 14, 2024
1 parent 7cad3e2 commit 8e7554b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 2 additions & 5 deletions crates/polars-arrow/src/bitmap/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,8 @@ impl Bitmap {
/// Unsound iff `i >= self.len()`.
#[inline]
pub unsafe fn get_bit_unchecked(&self, i: usize) -> bool {
if cfg!(debug_assertions) {
self.get_bit(i)
} else {
get_bit_unchecked(&self.storage, self.offset + i)
}
debug_assert!(i < self.len());
get_bit_unchecked(&self.storage, self.offset + i)
}

/// Returns a pointer to the start of this [`Bitmap`] (ignores `offsets`)
Expand Down
9 changes: 3 additions & 6 deletions crates/polars-arrow/src/bitmap/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,9 @@ impl MutableBitmap {
/// Caller must ensure that `index < self.len()`
#[inline]
pub unsafe fn set_unchecked(&mut self, index: usize, value: bool) {
if cfg!(debug_assertions) {
self.set(index, value)
} else {
let byte = self.buffer.get_unchecked_mut(index / 8);
*byte = set_bit_in_byte(*byte, index % 8, value);
}
debug_assert!(index < self.len());
let byte = self.buffer.get_unchecked_mut(index / 8);
*byte = set_bit_in_byte(*byte, index % 8, value);
}

/// Shrinks the capacity of the [`MutableBitmap`] to fit its current length.
Expand Down

0 comments on commit 8e7554b

Please sign in to comment.