@@ -85,8 +85,8 @@ putWordS n w s@(S builder b o bo) = s'
85 w' = case bo of
85 w' = case bo of
87 BL -> w `fastShiftR` cn
87 BL -> w `fastShiftR` cn
88− LB -> w `fastShiftR` cn
88+ LL -> w `fastShiftR` cn
91 -- Select bits to store in the current byte.
91 -- Select bits to store in the current byte.
92 -- Put them in the correct order and return them in the least-significant
92 -- Put them in the correct order and return them in the least-significant
@@ -94,8 +94,8 @@ putWordS n w s@(S builder b o bo) = s'
94 selectBits :: (Num a, FastBits a, Integral a) => a -> Word8
94 selectBits :: (Num a, FastBits a, Integral a) => a -> Word8
95 selectBits x = fromIntegral $ case bo of
95 selectBits x = fromIntegral $ case bo of
96 BB -> mask cn $ x `fastShiftR` (n-cn)
96 BB -> mask cn $ x `fastShiftR` (n-cn)
97− LL -> reverseBits cn $ mask cn $ x `fastShiftR` (n-cn)
97+ LB -> reverseBits cn $ mask cn $ x `fastShiftR` (n-cn)
98− LB -> mask cn x
98+ LL -> mask cn x
99 BL -> reverseBits cn $ mask cn x
99 BL -> reverseBits cn $ mask cn x
101 -- shift left at the correct position
101 -- shift left at the correct position
@@ -103,8 +103,8 @@ putWordS n w s@(S builder b o bo) = s'
103 shl x = case bo of
103 shl x = case bo of
104 BB -> x `fastShiftL` (8-o-cn)
104 BB -> x `fastShiftL` (8-o-cn)
105 BL -> x `fastShiftL` (8-o-cn)
105 BL -> x `fastShiftL` (8-o-cn)
106− LB -> x `fastShiftL` o
107 LL -> x `fastShiftL` o
106 LL -> x `fastShiftL` o
107+ LB -> x `fastShiftL` o
109 flush s2@(S b2 w2 o2 bo2)
109 flush s2@(S b2 w2 o2 bo2)
110 | o2 == 8 = S (b2 `mappend` B.singleton w2) 0 0 bo2
110 | o2 == 8 = S (b2 `mappend` B.singleton w2) 0 0 bo2
@@ -143,9 +143,9 @@ putWord64be = putWord
144-- Examples: 3 bits are already written in the current byte
144-- Examples: 3 bits are already written in the current byte
145-- BB: ABCDEFGH IJKLMNOP -> xxxABCDE FGHIJKLM NOPxxxxx
145-- BB: ABCDEFGH IJKLMNOP -> xxxABCDE FGHIJKLM NOPxxxxx
146−-- LB: ABCDEFGH IJKLMNOP -> LMNOPxxx DEFGHIJK xxxxxABC
146+-- LL: ABCDEFGH IJKLMNOP -> LMNOPxxx DEFGHIJK xxxxxABC
147-- BL: ABCDEFGH IJKLMNOP -> xxxPONML KJIHGFED CBAxxxxx
147-- BL: ABCDEFGH IJKLMNOP -> xxxPONML KJIHGFED CBAxxxxx
148−-- LL: ABCDEFGH IJKLMNOP -> EDCBAxxx MLKJIHGF xxxxxPON
148+-- LB: ABCDEFGH IJKLMNOP -> EDCBAxxx MLKJIHGF xxxxxPON
149putByteString :: ByteString -> BitPut ()
149putByteString :: ByteString -> BitPut ()
150putByteString bs = BitPut $ \s -> PairS () (putByteStringS bs s)
150putByteString bs = BitPut $ \s -> PairS () (putByteStringS bs s)
@@ -154,13 +154,13 @@ putByteStringS bs s
154 | BS.null bs = s
154 | BS.null bs = s
155 | otherwise = case s of
155 | otherwise = case s of
156 (S builder b 0 BB) -> S (builder `mappend` B.fromByteString bs) b 0 BB
156 (S builder b 0 BB) -> S (builder `mappend` B.fromByteString bs) b 0 BB
157− (S builder b 0 LB) -> S (builder `mappend` B.fromByteString (BS.reverse bs)) b 0 LB
157+ (S builder b 0 LL) -> S (builder `mappend` B.fromByteString (BS.reverse bs)) b 0 LL
158− (S builder b 0 LL) -> S (builder `mappend` B.fromByteString (rev bs)) b 0 LL
158+ (S builder b 0 LB) -> S (builder `mappend` B.fromByteString (rev bs)) b 0 LB
159 (S builder b 0 BL) -> S (builder `mappend` B.fromByteString (rev (BS.reverse bs))) b 0 BL
159 (S builder b 0 BL) -> S (builder `mappend` B.fromByteString (rev (BS.reverse bs))) b 0 BL
160 (S _ _ _ BB) -> putByteStringS (BS.unsafeTail bs) (putWordS 8 (BS.unsafeHead bs) s)
160 (S _ _ _ BB) -> putByteStringS (BS.unsafeTail bs) (putWordS 8 (BS.unsafeHead bs) s)
161− (S _ _ _ LB) -> putByteStringS (BS.unsafeInit bs) (putWordS 8 (BS.unsafeLast bs) s)
161+ (S _ _ _ LL) -> putByteStringS (BS.unsafeInit bs) (putWordS 8 (BS.unsafeLast bs) s)
162 (S _ _ _ BL) -> putByteStringS (BS.unsafeInit bs) (putWordS 8 (BS.unsafeLast bs) s)
162 (S _ _ _ BL) -> putByteStringS (BS.unsafeInit bs) (putWordS 8 (BS.unsafeLast bs) s)
163− (S _ _ _ LL) -> putByteStringS (BS.unsafeTail bs) (putWordS 8 (BS.unsafeHead bs) s)
163+ (S _ _ _ LB) -> putByteStringS (BS.unsafeTail bs) (putWordS 8 (BS.unsafeHead bs) s)
165 rev = BS.map (reverseBits 8)
165 rev = BS.map (reverseBits 8)