@@ -3075,20 +3075,27 @@ decodeUtf8With cfm (Stream step state) = Stream step' (FreshPoint 0 0 state)
3075 return $
3075 return $
3076 case r of
3076 case r of
3077 Yield x s ->
3077 Yield x s ->
3078+ if statePtr == 0 && x <= 0x7f
3082+ (unsafeChr (fromIntegral x))
3078− let (Tuple' sv cp) =
3085+ let (Tuple' sv cp) =
3079− decode statePtr codepointPtr x
3086+ decode statePtr codepointPtr x
3080− in case sv of
3087+ in case sv of
3083− transliterateOrError
3090+ transliterateOrError
3084− "Streamly.Streams.StreamD.decodeUtf8With: Invalid UTF8 codepoint encountered"
3091+ "Streamly.Streams.StreamD.decodeUtf8With: Invalid UTF8 codepoint encountered"
3085− (FreshPoint 0 0 s)
3092+ (FreshPoint 0 0 s)
3088− YieldAndContinue
3095+ YieldAndContinue
3089− (unsafeChr (fromIntegral cp))
3096+ (unsafeChr (fromIntegral cp))
3090− (FreshPoint cp sv s)
3097+ (FreshPoint cp sv s)
3091− _ -> Skip (FreshPoint cp sv s)
3098+ _ -> Skip (FreshPoint cp sv s)
3092 Skip s -> Skip (FreshPoint codepointPtr statePtr s)
3099 Skip s -> Skip (FreshPoint codepointPtr statePtr s)
3094 if statePtr /= 0
3101 if statePtr /= 0
@@ -3162,20 +3169,26 @@ decodeUtf8ArraysWith cfm (Stream step state) =
3162 r <- peek p
3169 r <- peek p
3163 touchForeignPtr startf
3170 touchForeignPtr startf
3164 return r
3171 return r
3172+ if statePtr == 0 && x <= 0x7f
3174+ return $ Skip $ YAndC
3175+ (unsafeChr (fromIntegral x))
3176+ (InnerLoop 0 0 st startf (p `plusPtr` 1) end)
3165− let (Tuple' sv cp) = decode statePtr codepointPtr x
3178+ let (Tuple' sv cp) = decode statePtr codepointPtr x
3166− return $
3179+ return $
3167− case sv of
3180+ case sv of
3170− transliterateOrError
3183+ transliterateOrError
3171− "Streamly.Streams.StreamD.decodeUtf8ArraysWith: Invalid UTF8 codepoint encountered"
3184+ "Streamly.Streams.StreamD.decodeUtf8ArraysWith: Invalid UTF8 codepoint encountered"
3172− (InnerLoop 0 0 st startf (p `plusPtr` 1) end)
3185+ (InnerLoop 0 0 st startf (p `plusPtr` 1) end)
3176− (unsafeChr (fromIntegral cp))
3189+ (unsafeChr (fromIntegral cp))
3177− (InnerLoop cp sv st startf (p `plusPtr` 1) end)
3190+ (InnerLoop cp sv st startf (p `plusPtr` 1) end)
3178− _ -> Skip (InnerLoop cp sv st startf (p `plusPtr` 1) end)
3191+ _ -> Skip (InnerLoop cp sv st startf (p `plusPtr` 1) end)
3179 step' _ (YAndC c s) = return $ Yield c s
3192 step' _ (YAndC c s) = return $ Yield c s
3180 step' _ D = return Stop
3193 step' _ D = return Stop