Skip to content

Commit

Permalink
new new impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachelint committed Aug 30, 2024
1 parent 12720dc commit 787de57
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use std::{
collections::VecDeque,
fmt::{self, Debug},
iter,
ops::{Index, IndexMut, Shl},
ops::{Index, IndexMut},
};

use arrow::{
Expand Down Expand Up @@ -484,29 +484,29 @@ impl BlockedGroupIndex {
}

pub struct BlockedGroupIndexBuilder {
block_id_mask: u64,
block_offset_mask: u64,
id_shift: u64,
}

impl BlockedGroupIndexBuilder {
pub fn new(is_blocked: bool) -> Self {
if is_blocked {
Self {
block_id_mask: BLOCKED_GROUP_INDEX_ID_MASK,
block_offset_mask: BLOCKED_GROUP_INDEX_OFFSET_MASK,
id_shift: 32,
}
} else {
Self {
block_id_mask: FLAT_GROUP_INDEX_ID_MASK,
block_offset_mask: FLAT_GROUP_INDEX_OFFSET_MASK,
id_shift: 64,
}
}
}

#[inline]
pub fn build(&self, packed_index: usize) -> BlockedGroupIndex {
let packed_index = packed_index as u64;
let block_id = ((packed_index & self.block_id_mask) >> 32) as u32;
let block_id = (packed_index >> self.id_shift) as u32;
let block_offset = packed_index & self.block_offset_mask;

BlockedGroupIndex {
Expand Down

0 comments on commit 787de57

Please sign in to comment.