@@ -109,10 +109,10 @@ contains (W8# word#) (Utf8 ba#) =
109109 containsHelp word# ba# 0 # (sizeofByteArray# ba# )
110110
111111
112- containsHelp :: Word # -> ByteArray # -> Int # -> Int # -> Bool
112+ containsHelp :: Word8 # -> ByteArray # -> Int # -> Int # -> Bool
113113containsHelp word# ba# ! offset# len# =
114114 if isTrue# (offset# <# len# ) then
115- if isTrue# (eqWord # word# (indexWord8Array# ba# offset# ))
115+ if isTrue# (eqWord8 # word# (indexWord8Array# ba# offset# ))
116116 then True
117117 else containsHelp word# ba# (offset# +# 1 # ) len#
118118 else
@@ -145,7 +145,7 @@ startsWithChar isGood bytes@(Utf8 ba#) =
145145 False
146146 else
147147 let
148- ! w# = indexWord8Array# ba# 0 #
148+ ! w# = word8ToWord # ( indexWord8Array# ba# 0 # )
149149 ! char
150150 | isTrue# (ltWord# w# 0xC0 ## ) = C # (chr# (word2Int# w# ))
151151 | isTrue# (ltWord# w# 0xE0 ## ) = chr2 ba# 0 # w#
@@ -164,7 +164,7 @@ endsWithWord8 (W8# w#) (Utf8 ba#) =
164164 let len# = sizeofByteArray# ba# in
165165 isTrue# (len# ># 0 # )
166166 &&
167- isTrue# (eqWord # w# (indexWord8Array# ba# (len# -# 1 # )))
167+ isTrue# (eqWord8 # w# (indexWord8Array# ba# (len# -# 1 # )))
168168
169169
170170
@@ -186,11 +186,11 @@ splitHelp str start offsets =
186186 unsafeSlice str start offset : splitHelp str (offset + 1 ) offsets
187187
188188
189- findDividers :: Word # -> ByteArray # -> Int # -> Int # -> [Int ] -> [Int ]
189+ findDividers :: Word8 # -> ByteArray # -> Int # -> Int # -> [Int ] -> [Int ]
190190findDividers divider# ba# ! offset# len# revOffsets =
191191 if isTrue# (offset# <# len# ) then
192192 findDividers divider# ba# (offset# +# 1 # ) len# $
193- if isTrue# (eqWord # divider# (indexWord8Array# ba# offset# ))
193+ if isTrue# (eqWord8 # divider# (indexWord8Array# ba# offset# ))
194194 then I # offset# : revOffsets
195195 else revOffsets
196196 else
@@ -351,7 +351,7 @@ toCharsHelp ba# offset# len# =
351351 []
352352 else
353353 let
354- ! w# = indexWord8Array# ba# offset#
354+ ! w# = word8ToWord # ( indexWord8Array# ba# offset# )
355355 ! (# char, width# # )
356356 | isTrue# (ltWord# w# 0xC0 ## ) = (# C # (chr# (word2Int# w# )), 1 # # )
357357 | isTrue# (ltWord# w# 0xE0 ## ) = (# chr2 ba# offset# w# , 2 # # )
@@ -368,7 +368,7 @@ chr2 :: ByteArray# -> Int# -> Word# -> Char
368368chr2 ba# offset# firstWord# =
369369 let
370370 ! i1# = word2Int# firstWord#
371- ! i2# = word2Int # (indexWord8Array# ba# (offset# +# 1 # ))
371+ ! i2# = word8ToInt # (indexWord8Array# ba# (offset# +# 1 # ))
372372 ! c1# = uncheckedIShiftL# (i1# -# 0xC0 # ) 6 #
373373 ! c2# = i2# -# 0x80 #
374374 in
@@ -380,8 +380,8 @@ chr3 :: ByteArray# -> Int# -> Word# -> Char
380380chr3 ba# offset# firstWord# =
381381 let
382382 ! i1# = word2Int# firstWord#
383- ! i2# = word2Int # (indexWord8Array# ba# (offset# +# 1 # ))
384- ! i3# = word2Int # (indexWord8Array# ba# (offset# +# 2 # ))
383+ ! i2# = word8ToInt # (indexWord8Array# ba# (offset# +# 1 # ))
384+ ! i3# = word8ToInt # (indexWord8Array# ba# (offset# +# 2 # ))
385385 ! c1# = uncheckedIShiftL# (i1# -# 0xE0 # ) 12 #
386386 ! c2# = uncheckedIShiftL# (i2# -# 0x80 # ) 6 #
387387 ! c3# = i3# -# 0x80 #
@@ -394,9 +394,9 @@ chr4 :: ByteArray# -> Int# -> Word# -> Char
394394chr4 ba# offset# firstWord# =
395395 let
396396 ! i1# = word2Int# firstWord#
397- ! i2# = word2Int # (indexWord8Array# ba# (offset# +# 1 # ))
398- ! i3# = word2Int # (indexWord8Array# ba# (offset# +# 2 # ))
399- ! i4# = word2Int # (indexWord8Array# ba# (offset# +# 3 # ))
397+ ! i2# = word8ToInt # (indexWord8Array# ba# (offset# +# 1 # ))
398+ ! i3# = word8ToInt # (indexWord8Array# ba# (offset# +# 2 # ))
399+ ! i4# = word8ToInt # (indexWord8Array# ba# (offset# +# 3 # ))
400400 ! c1# = uncheckedIShiftL# (i1# -# 0xF0 # ) 18 #
401401 ! c2# = uncheckedIShiftL# (i2# -# 0x80 # ) 12 #
402402 ! c3# = uncheckedIShiftL# (i3# -# 0x80 # ) 6 #
@@ -405,6 +405,10 @@ chr4 ba# offset# firstWord# =
405405 C # (chr# (c1# +# c2# +# c3# +# c4# ))
406406
407407
408+ word8ToInt# :: Word8 # -> Int #
409+ word8ToInt# word8 =
410+ word2Int# (word8ToWord# word8)
411+
408412
409413-- TO BUILDER
410414
@@ -471,7 +475,7 @@ toEscapedBuilderHelp before after !name@(Utf8 ba#) k =
471475escape :: Word8 -> Word8 -> Ptr a -> Utf8 t -> Int -> Int -> Int -> IO ()
472476escape before@ (W8 # before# ) after ptr name@ (Utf8 ba# ) offset@ (I # offset# ) len@ (I # len# ) i@ (I # i# ) =
473477 if isTrue# (i# <# len# ) then
474- if isTrue# (eqWord # before# (indexWord8Array# ba# (offset# +# i# )))
478+ if isTrue# (eqWord8 # before# (indexWord8Array# ba# (offset# +# i# )))
475479 then
476480 do writeWordToPtr ptr i after
477481 escape before after ptr name offset len (i + 1 )
0 commit comments