@@ -58,6 +58,7 @@ module Data.Binary.Bits.Get
58 , BitOrder(..)
58 , BitOrder(..)
59 , runBitGet
59 , runBitGet
60 , selectBitOrder
60 , selectBitOrder
62 -- ** Get bytes
63 -- ** Get bytes
@@ -358,6 +359,13 @@ withState f = do
358 s <- getState
359 s <- getState
359 putState $! f s
360 putState $! f s
362+-- | Get the bit ordering
363+getBitOrder :: BitGet BitOrder
365+ (S _ _ bo) <- getState
361-- | Make sure there are at least @n@ bits.
369-- | Make sure there are at least @n@ bits.
362ensureBits :: Int -> BitGet ()
370ensureBits :: Int -> BitGet ()
363ensureBits n = do
371ensureBits n = do
@@ -388,6 +396,16 @@ alignByte = do
388selectBitOrder :: BitOrder -> BitGet ()
396selectBitOrder :: BitOrder -> BitGet ()
389selectBitOrder = withState . selectBitOrderS
397selectBitOrder = withState . selectBitOrderS
399+withBitOrder :: BitOrder -> BitGet a -> BitGet a
400+withBitOrder bo f = do
391-- | Test whether all input has been consumed, i.e. there are no remaining
409-- | Test whether all input has been consumed, i.e. there are no remaining
392-- undecoded bytes.
410-- undecoded bytes.
393isEmpty :: BitGet Bool
411isEmpty :: BitGet Bool