-- |
-- Module:      Data.Bit.PdepPext
-- Copyright:   (c) 2022 Andrew Lelechenko
-- Licence:     BSD3
--
-- | Parallel bit deposit and extract instructions.
-- https://en.wikipedia.org/wiki/Bit_Manipulation_Instruction_Sets#Parallel_bit_deposit_and_extract

{-# LANGUAGE MagicHash    #-}

module Data.Bit.PdepPext
  ( pdep
  , pext
  ) where

import GHC.Exts

pdep :: Word -> Word -> Word
pdep :: Word -> Word -> Word
pdep (W# Word#
src#) (W# Word#
mask#) = Word# -> Word
W# (Word# -> Word# -> Word#
pdep# Word#
src# Word#
mask#)

pext :: Word -> Word -> Word
pext :: Word -> Word -> Word
pext (W# Word#
src#) (W# Word#
mask#) = Word# -> Word
W# (Word# -> Word# -> Word#
pext# Word#
src# Word#
mask#)