@@ -85,8 +85,8 @@ putWordS n w s@(S builder b o bo) = s'
8585 w' = case bo of
8686 BB -> w
8787 BL -> w `fastShiftR` cn
88− LB -> w `fastShiftR` cn
89− LL -> w
88+ LL -> w `fastShiftR` cn
89+ LB -> w
9090
9191 -- Select bits to store in the current byte.
9292 -- 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'
9494 selectBits :: (Num a, FastBits a, Integral a) => a -> Word8
9595 selectBits x = fromIntegral $ case bo of
9696 BB -> mask cn $ x `fastShiftR` (n-cn)
97− LL -> reverseBits cn $ mask cn $ x `fastShiftR` (n-cn)
98− LB -> mask cn x
97+ LB -> reverseBits cn $ mask cn $ x `fastShiftR` (n-cn)
98+ LL -> mask cn x
9999 BL -> reverseBits cn $ mask cn x
100100
101101 -- shift left at the correct position
@@ -103,8 +103,8 @@ putWordS n w s@(S builder b o bo) = s'
103103 shl x = case bo of
104104 BB -> x `fastShiftL` (8-o-cn)
105105 BL -> x `fastShiftL` (8-o-cn)
106− LB -> x `fastShiftL` o
107106 LL -> x `fastShiftL` o
107+ LB -> x `fastShiftL` o
108108
109109 flush s2@(S b2 w2 o2 bo2)
110110 | o2 == 8 = S (b2 `mappend` B.singleton w2) 0 0 bo2
@@ -143,9 +143,9 @@ putWord64be = putWord
143143--
144144-- Examples: 3 bits are already written in the current byte
145145-- BB: ABCDEFGH IJKLMNOP -> xxxABCDE FGHIJKLM NOPxxxxx
146−-- LB: ABCDEFGH IJKLMNOP -> LMNOPxxx DEFGHIJK xxxxxABC
146+-- LL: ABCDEFGH IJKLMNOP -> LMNOPxxx DEFGHIJK xxxxxABC
147147-- BL: ABCDEFGH IJKLMNOP -> xxxPONML KJIHGFED CBAxxxxx
148−-- LL: ABCDEFGH IJKLMNOP -> EDCBAxxx MLKJIHGF xxxxxPON
148+-- LB: ABCDEFGH IJKLMNOP -> EDCBAxxx MLKJIHGF xxxxxPON
149149putByteString :: ByteString -> BitPut ()
150150putByteString bs = BitPut $ \s -> PairS () (putByteStringS bs s)
151151
@@ -154,13 +154,13 @@ putByteStringS bs s
154154 | BS.null bs = s
155155 | otherwise = case s of
156156 (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
158− (S builder b 0 LL) -> S (builder `mappend` B.fromByteString (rev bs)) b 0 LL
157+ (S builder b 0 LL) -> S (builder `mappend` B.fromByteString (BS.reverse bs)) b 0 LL
158+ (S builder b 0 LB) -> S (builder `mappend` B.fromByteString (rev bs)) b 0 LB
159159 (S builder b 0 BL) -> S (builder `mappend` B.fromByteString (rev (BS.reverse bs))) b 0 BL
160160 (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)
162162 (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)
164164 where
165165 rev = BS.map (reverseBits 8)
166166