bv-embed-0.1.0: Define embeddings of small bit vectors into larger ones

Data.BitVector.Embed

Description

This module exports types and functions for defining how a small bit vector is embedded into a larger one.

Synopsis

# Documentation

Defines a mapping from each bit of a small bit vector into a larger one.

Instances
 Source # Instance detailsDefined in Data.BitVector.Embed Methods Source # Instance detailsDefined in Data.BitVector.Embed Methods Source # Instance detailsDefined in Data.BitVector.Embed MethodsshowList :: [BitEmbedding] -> ShowS #

fromList :: [Int] -> BitEmbedding Source #

Construct a BitEmbedding from a list, where the length of the list is the same as the width of the "small" bit vector we are embedding into the larger one. The nth element of the list tells us at which bit index in the target to embed bit n of the source.

bitEmbed :: (Bits src, Bits tgt) => BitEmbedding -> src -> tgt -> tgt Source #

Embed a smaller bit vector into a larger one using a BitEmbedding.

>>> bitEmbed (fromList [4,5,7] 7 0)
176


bitExtract :: (Bits src, Bits tgt) => BitEmbedding -> tgt -> src Source #

Extract a smaller bit vector from a larger one using a BitEmbedding.

>>> bitExtract (fromList [4,5,7] 7 0) 176
7