@@ -5,6 +5,7 @@ module BitsPut
55 , putBool
66 , putWord8
77 , putWord16be
8+ , putWord32be
89 )
910 where
1011
@@ -62,6 +63,17 @@ putWord16be n w
6263 t' = fromIntegral (w `shiftL` (8-o'))
6364 in (S (b `mappend` B.singleton w' `mappend` B.singleton w'') t' o')
6465
66+putWord32be :: Int -> Word32 -> BitPut ()
67+putWord32be n w
68+ | n <= 16 = putWord16be n (fromIntegral w)
69+ | otherwise = do
70+ putWord32be (n-16) (w`shiftR`16)
71+ putWord32be 16 (w .&. 0x0000ffff)
72+
73+putWord64be :: Int -> Word64 -> BitPut ()
74+putWord64be n w
75+ | n <= 16 = putWord16be n (fromIntegral w)
76+
6577flush :: S -> S
6678flush s@(S b w o)
6779 | o > 8 = error "flush: offset > 8"