Commits

Edward Kmett committed cf61094

Use `shiftR` as `length >= 0`

  • Participants
  • Parent commits 6f568df

Comments (0)

Files changed (1)

Data/Text/Internal/Fusion.hs

 
 import Prelude (Bool(..), Char, Maybe(..), Monad(..), Int,
                 Num(..), Ord(..), ($), (&&),
-                fromIntegral, otherwise, quot)
+                fromIntegral, otherwise)
 import Data.Bits ((.&.))
 import Data.Text.Internal (Text(..))
 import Data.Text.Internal.Private (runText)
 
 -- | /O(n)/ Convert a 'Text' into a 'Stream Char'.
 stream :: Text -> Stream Char
-stream (Text arr off len) = Stream next off (betweenSize (len `quot` 2) len)
+stream (Text arr off len) = Stream next off (betweenSize (len `shiftR` 1) len)
     where
       !end = off+len
       next !i
 -- | /O(n)/ Convert a 'Text' into a 'Stream Char', but iterate
 -- backwards.
 reverseStream :: Text -> Stream Char
-reverseStream (Text arr off len) = Stream next (off+len-1) (betweenSize (len `quot` 2) len)
+reverseStream (Text arr off len) = Stream next (off+len-1) (betweenSize (len `shiftR` 1) len)
     where
       {-# INLINE next #-}
       next !i