Skip to content

Commit

Permalink
remove vestigial
Browse files Browse the repository at this point in the history
  • Loading branch information
lwwmanning committed Jul 19, 2024
1 parent d46e9f0 commit d63a0e7
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,51 +173,6 @@ macro_rules! unpack {
};
}

#[macro_export]
macro_rules! unpack_single {
// $W must be constant / compile-time known
($T:ty, $W:expr, $packed:expr, $row:expr, $lane:expr) => {{
use $crate::{FastLanes, seq_t};
use paste::paste;

// The number of bits of T.
const T: usize = <$T>::T;

if $W == 0 {
// Special case for W=0, we just need to zero the output.
return 0 as $T;
} else if $W == T {
return $packed[<$T>::LANES * $row + $lane];
}

paste!(seq_t!(ROW in $T {
match $row {
#(ROW => {
const MASK: $T = (1 << ($W % T)) - 1;
const START_BIT: usize = ROW * $W;

const START_WORD: usize = START_BIT / T;
// bits to shift out of lo word
const LO_SHIFT: usize = START_BIT % T;
// remaining bits in the lo word == bits to shift from hi word
const REMAINING_BITS: usize = T - LO_SHIFT;

let lo = packed[<$T>::LANES * START_WORD + $lane] >> LO_SHIFT;
return if REMAINING_BITS >= W {
// in this case we will mask out all bits of hi word
lo & MASK
} else {
// guaranteed that lo_shift > 0 and thus remaining_bits < T
let hi = packed[<$T>::LANES * (START_WORD + 1) + $lane] << REMAINING_BITS;
(lo | hi) & MASK
}
},)*
_ => unreachable!("Unsupported row: {}", row)
}
}))
}}
}

#[cfg(test)]
mod test {
use crate::{BitPacking, FastLanes};
Expand Down

0 comments on commit d63a0e7

Please sign in to comment.