@@ -436,11 +436,11 @@ encodeUtf8_1 (Text arr off len)
436436 loop n1 m1 ptr = go n1 m1
437437 where
438438 offLen = off + len
439+ poke8 p k v = poke (p `plusPtr` k) (fromIntegral v :: Word8)
439440 go !n !m
440441 | n == offLen = return (PS fp 0 m)
441442 | otherwise = do
442− let poke8 k v = poke (ptr `plusPtr` k) (fromIntegral v :: Word8)
443− ensure k act
443+ let ensure k act
444444 | size-m >= k = act
445445 | otherwise = {-# SCC "resizeUtf8/ensure" #-} do
446446 let newSize = size `shiftL` 1
@@ -451,23 +451,23 @@ encodeUtf8_1 (Text arr off len)
451451 {-# INLINE ensure #-}
452452 case A.unsafeIndex arr n of
453453 w| w <= 0x7F -> ensure 1 $ do
454− poke (ptr `plusPtr` m) (fromIntegral w :: Word8)
454+ poke8 ptr m (fromIntegral w :: Word8)
455455 go (n+1) (m+1)
456456 | w <= 0x7FF -> ensure 2 $ do
457− poke8 m $ (w `shiftR` 6) + 0xC0
458− poke8 (m+1) $ (w .&. 0x3f) + 0x80
457+ poke8 ptr m $ (w `shiftR` 6) + 0xC0
458+ poke8 ptr (m+1) $ (w .&. 0x3f) + 0x80
459459 go (n+1) (m+2)
460460 | 0xD800 <= w && w <= 0xDBFF -> ensure 4 $ do
461461 let c = ord $ U16.chr2 w (A.unsafeIndex arr (n+1))
462− poke8 m $ (c `shiftR` 18) + 0xF0
463− poke8 (m+1) $ ((c `shiftR` 12) .&. 0x3F) + 0x80
464− poke8 (m+2) $ ((c `shiftR` 6) .&. 0x3F) + 0x80
465− poke8 (m+3) $ (c .&. 0x3F) + 0x80
462+ poke8 ptr m $ (c `shiftR` 18) + 0xF0
463+ poke8 ptr (m+1) $ ((c `shiftR` 12) .&. 0x3F) + 0x80
464+ poke8 ptr (m+2) $ ((c `shiftR` 6) .&. 0x3F) + 0x80
465+ poke8 ptr (m+3) $ (c .&. 0x3F) + 0x80
466466 go (n+2) (m+4)
467467 | otherwise -> ensure 3 $ do
468− poke8 m $ (w `shiftR` 12) + 0xE0
469− poke8 (m+1) $ ((w `shiftR` 6) .&. 0x3F) + 0x80
470− poke8 (m+2) $ (w .&. 0x3F) + 0x80
468+ poke8 ptr m $ (w `shiftR` 12) + 0xE0
469+ poke8 ptr (m+1) $ ((w `shiftR` 6) .&. 0x3F) + 0x80
470+ poke8 ptr (m+2) $ (w .&. 0x3F) + 0x80
471471 go (n+1) (m+3)
472472
473473#endif