-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
136 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod mutable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use arrow::bitmap::MutableBitmap; | ||
|
||
pub trait MutableBitmapExtension { | ||
/// Initializes a [`MutableBitmap`] with all values set to valid/ true. | ||
fn from_len_set(length: usize) -> MutableBitmap { | ||
let values = vec![u8::MAX; length.saturating_add(7) / 8]; | ||
MutableBitmap::from_vec(values, length) | ||
} | ||
|
||
fn as_slice_mut(&mut self) -> &mut [u8]; | ||
|
||
/// # Safety | ||
/// Caller must ensure `i` is in bounds. | ||
unsafe fn set_bit_unchecked(&mut self, i: usize, value: bool); | ||
} | ||
|
||
impl MutableBitmapExtension for MutableBitmap { | ||
fn as_slice_mut(&mut self) -> &mut [u8] { | ||
let slice = self.as_slice(); | ||
unsafe { std::slice::from_raw_parts_mut(slice.as_ptr() as *mut u8, slice.len()) } | ||
} | ||
|
||
unsafe fn set_bit_unchecked(&mut self, i: usize, value: bool) { | ||
#[cfg(debug_assertions)] | ||
{ | ||
arrow::bitmap::utils::set_bit(self.as_slice_mut(), i, value) | ||
} | ||
#[cfg(not(debug_assertions))] | ||
{ | ||
arrow::bitmap::utils::set_bit_unchecked(self.as_slice_mut(), i, value) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod array; | ||
pub mod bit_util; | ||
mod bitmap; | ||
#[cfg(feature = "compute")] | ||
pub mod compute; | ||
pub mod conversion; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters