1#[cfg(feature = "arrow")]
10mod arrow;
11mod buf;
12mod buf_mut;
13mod macros;
14mod ops;
15mod view;
16
17pub use arrow_buffer::bit_chunk_iterator::BitChunkIterator;
18pub use arrow_buffer::bit_chunk_iterator::BitChunks;
19pub use arrow_buffer::bit_chunk_iterator::UnalignedBitChunk;
20pub use arrow_buffer::bit_chunk_iterator::UnalignedBitChunkIterator;
21pub use arrow_buffer::bit_iterator::BitIndexIterator;
22pub use arrow_buffer::bit_iterator::BitIterator;
23pub use arrow_buffer::bit_iterator::BitSliceIterator;
24pub use buf::*;
25pub use buf_mut::*;
26pub use view::*;
27
28#[inline(always)]
30pub fn get_bit(buf: &[u8], index: usize) -> bool {
31 buf[index / 8] & (1 << (index % 8)) != 0
32}
33
34#[inline(always)]
40pub unsafe fn get_bit_unchecked(buf: *const u8, index: usize) -> bool {
41 (unsafe { *buf.add(index / 8) } & (1 << (index % 8))) != 0
42}
43
44#[inline(always)]
50pub unsafe fn set_bit_unchecked(buf: *mut u8, index: usize) {
51 unsafe { *buf.add(index / 8) |= 1 << (index % 8) };
52}
53
54#[inline(always)]
60pub unsafe fn unset_bit_unchecked(buf: *mut u8, index: usize) {
61 unsafe { *buf.add(index / 8) &= !(1 << (index % 8)) };
62}