on master help sign in
Comments.
commit0285c997790a637da8e18cad24d10448cb8b898d authorLennart Kolmodin <kolmodin@gmail.com> dateWed 1 Jun 2011, 10:11 (15 years ago) parent9ac2563
1 file changed+2−1
BitsGet.hs+2−1
BitsGet.hs+2−1
@@ -45,7 +45,7 @@ data S = S !ByteString -- ^ Input
4545 !Int -- ^ Bit offset (0-7)
4646 deriving (Show)
4747
48−-- make_mask 3 = 00000111
48+-- | make_mask 3 = 00000111
4949make_mask :: Bits a => Int -> a
5050make_mask n = (1 `shiftL` fromIntegral n) - 1
5151{-# SPECIALIZE make_mask :: Int -> Word #-}
@@ -265,6 +265,7 @@ runBitGet bg = do
265265 putS bs''
266266 return (Right x)
267267
268+-- | Make sure there are at lest @n@ bits.
268269ensureBits :: Int -> BitGet ()
269270ensureBits n = C $ \s kf ks ->
270271 let loop (S bs o) | n <= (B.length bs * 8 - o) = ks (S bs o) ()