polars_expr/
lib.rs

1mod expressions;
2pub mod groups;
3pub mod hash_keys;
4pub mod hot_groups;
5pub mod idx_table;
6pub mod planner;
7pub mod prelude;
8pub mod reduce;
9pub mod state;
10
11use polars_utils::IdxSize;
12
13pub use crate::planner::{ExpressionConversionState, create_physical_expr};
14
15/// An index where the top bit indicates whether a value should be evicted.
16pub struct EvictIdx(IdxSize);
17
18impl EvictIdx {
19    #[inline(always)]
20    pub fn new(idx: IdxSize, should_evict: bool) -> Self {
21        debug_assert!(idx >> (IdxSize::BITS - 1) == 0);
22        Self(idx | ((should_evict as IdxSize) << (IdxSize::BITS - 1)))
23    }
24
25    #[inline(always)]
26    pub fn idx(&self) -> usize {
27        (self.0 & ((1 << (IdxSize::BITS - 1)) - 1)) as usize
28    }
29
30    #[inline(always)]
31    pub fn should_evict(&self) -> bool {
32        (self.0 >> (IdxSize::BITS - 1)) != 0
33    }
34}