Skip to content

Commit

Permalink
Minor tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
hvr committed Jan 27, 2018
1 parent 28ff06e commit 02b34da
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Data/Text/Short/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1412,21 +1412,21 @@ writeCodePoint1 mba ofs (CP cp) =

writeCodePoint2 :: MBA s -> B -> CP -> ST s ()
writeCodePoint2 mba ofs (CP cp) = do
writeWord8Array mba ofs (0xc0 .|. (cp `shiftR` 6))
writeWord8Array mba (ofs+1) (0x80 .|. (cp .&. 0x3f))
writeWord8Array mba ofs (0xc0 .|. (cp `unsafeShiftR` 6))
writeWord8Array mba (ofs+1) (0x80 .|. (cp .&. 0x3f))

writeCodePoint3 :: MBA s -> B -> CP -> ST s ()
writeCodePoint3 mba ofs (CP cp) = do
writeWord8Array mba ofs (0xe0 .|. (cp `shiftR` 12))
writeWord8Array mba (ofs+1) (0x80 .|. ((cp `shiftR` 6) .&. 0x3f))
writeWord8Array mba (ofs+2) (0x80 .|. (cp .&. 0x3f))
writeWord8Array mba ofs (0xe0 .|. (cp `unsafeShiftR` 12))
writeWord8Array mba (ofs+1) (0x80 .|. ((cp `unsafeShiftR` 6) .&. 0x3f))
writeWord8Array mba (ofs+2) (0x80 .|. (cp .&. 0x3f))

writeCodePoint4 :: MBA s -> B -> CP -> ST s ()
writeCodePoint4 mba ofs (CP cp) = do
writeWord8Array mba ofs (0xf0 .|. (cp `shiftR` 18))
writeWord8Array mba (ofs+1) (0x80 .|. ((cp `shiftR` 12) .&. 0x3f))
writeWord8Array mba (ofs+2) (0x80 .|. ((cp `shiftR` 6) .&. 0x3f))
writeWord8Array mba (ofs+3) (0x80 .|. (cp .&. 0x3f))
writeWord8Array mba ofs (0xf0 .|. (cp `unsafeShiftR` 18))
writeWord8Array mba (ofs+1) (0x80 .|. ((cp `unsafeShiftR` 12) .&. 0x3f))
writeWord8Array mba (ofs+2) (0x80 .|. ((cp `unsafeShiftR` 6) .&. 0x3f))
writeWord8Array mba (ofs+3) (0x80 .|. (cp .&. 0x3f))

writeRepChar :: MBA s -> B -> ST s ()
writeRepChar mba ofs = do
Expand Down

0 comments on commit 02b34da

Please sign in to comment.