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