getNBits = fromIntegral ∘ UV.unsafeIndex nbitsTable ∘ fromIntegral
where
nbitsTable ∷ UV.Vector Word8
+ {-# NOINLINE nbitsTable #-}
nbitsTable
= UV.fromList
[ 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 -- 0 - 15
getLog2 = fromIntegral ∘ UV.unsafeIndex log2Table ∘ fromIntegral
where
log2Table ∷ UV.Vector Word8
+ {-# NOINLINE log2Table #-}
log2Table
= UV.fromList
[ 0x00, 0x01, 0x03, 0x04, 0x06, 0x07, 0x09, 0x0a, 0x0B, 0x0D, 0x0E, 0x10, 0x11, 0x12, 0x14, 0x15
getExp2 = fromIntegral ∘ UV.unsafeIndex exp2Table ∘ fromIntegral
where
exp2Table ∷ UV.Vector Word8
+ {-# NOINLINE exp2Table #-}
exp2Table
= UV.fromList
[ 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x0a, 0x0B