@@ -159,9 +159,7 @@ stream_bs Utf16LE bs = Stream next 0 l
159 | i+3 < l && U16.validate2 x1 x2 = Yield (U16.chr2 x1 x2) (i+4)
159 | i+3 < l && U16.validate2 x1 x2 = Yield (U16.chr2 x1 x2) (i+4)
160 | otherwise = error $ "bsStream: bad UTF-16LE stream"
160 | otherwise = error $ "bsStream: bad UTF-16LE stream"
163 x1 = (shiftL (index (i + 1)) 8) + (index i)
162 x1 = (shiftL (index (i + 1)) 8) + (index i)
165 x2 = (shiftL (index (i + 3)) 8) + (index (i + 2))
163 x2 = (shiftL (index (i + 3)) 8) + (index (i + 2))
166 index = fromIntegral . B.unsafeIndex bs :: Int -> Word16
164 index = fromIntegral . B.unsafeIndex bs :: Int -> Word16
167stream_bs Utf16BE bs = Stream next 0 l
165stream_bs Utf16BE bs = Stream next 0 l
@@ -174,11 +172,9 @@ stream_bs Utf16BE bs = Stream next 0 l
174 | i+3 < l && U16.validate2 x1 x2 = Yield (U16.chr2 x1 x2) (i+4)
172 | i+3 < l && U16.validate2 x1 x2 = Yield (U16.chr2 x1 x2) (i+4)
175 | otherwise = error $ "bsStream: bad UTF16-BE stream "
173 | otherwise = error $ "bsStream: bad UTF16-BE stream "
178 x1 = (shiftL (index i) 8) + (index (i + 1))
175 x1 = (shiftL (index i) 8) + (index (i + 1))
180 x2 = (shiftL (index (i + 2)) 8) + (index (i + 3))
176 x2 = (shiftL (index (i + 2)) 8) + (index (i + 3))
181− index = fromIntegral . B.unsafeIndex bs
177+ index = fromIntegral . B.unsafeIndex bs :: Int -> Word16
182stream_bs Utf32BE bs = Stream next 0 l
178stream_bs Utf32BE bs = Stream next 0 l
184 l = B.length bs
180 l = B.length bs