{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE UnboxedSums #-}
{-# LANGUAGE UnboxedTuples #-}
module Data.Bytes.Text.Latin1
( toString
, fromString
, decodeDecWord
, equals1
, equals2
, equals3
, equals4
, equals5
, equals6
, equals7
, equals8
, equals9
, equals10
, equals11
, equals12
, equals13
, equals14
, equals15
) where
import Prelude hiding (length)
import Data.Bytes.Types (Bytes(..))
import Data.Char (ord,chr)
import Data.Primitive (ByteArray(ByteArray))
import Data.Word (Word8)
import GHC.Exts (Int(I#),Char(C#),or#,ltWord#,int2Word#)
import GHC.Exts (Word(W#),Word#)
import qualified Data.Primitive as PM
import qualified Data.Bytes.Pure as Bytes
import qualified GHC.Exts as Exts
fromString :: String -> Bytes
fromString :: String -> Bytes
fromString =
ByteArray -> Bytes
Bytes.fromByteArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. IsList l => [Item l] -> l
Exts.fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map (forall a b. (Integral a, Num b) => a -> b
fromIntegral @Int @Word8 forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord)
toString :: Bytes -> String
{-# INLINE toString #-}
toString :: Bytes -> String
toString = forall a. (Word8 -> a -> a) -> a -> Bytes -> a
Bytes.foldr (\Word8
w String
xs -> Int -> Char
chr (forall a b. (Integral a, Num b) => a -> b
fromIntegral @Word8 @Int Word8
w) forall a. a -> [a] -> [a]
: String
xs) []
equals1 :: Char -> Bytes -> Bool
{-# INLINE equals1 #-}
equals1 :: Char -> Bytes -> Bool
equals1 !Char
c0 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
1 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off
Int
_ -> Bool
False
equals2 :: Char -> Char -> Bytes -> Bool
equals2 :: Char -> Char -> Bytes -> Bool
equals2 !Char
c0 !Char
c1 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
2 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1)
Int
_ -> Bool
False
equals3 :: Char -> Char -> Char -> Bytes -> Bool
equals3 :: Char -> Char -> Char -> Bytes -> Bool
equals3 !Char
c0 !Char
c1 !Char
c2 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
3 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2)
Int
_ -> Bool
False
equals4 :: Char -> Char -> Char -> Char -> Bytes -> Bool
equals4 :: Char -> Char -> Char -> Char -> Bytes -> Bool
equals4 !Char
c0 !Char
c1 !Char
c2 !Char
c3 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
4 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3)
Int
_ -> Bool
False
equals5 :: Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals5 :: Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals5 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
5 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4)
Int
_ -> Bool
False
equals6 :: Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals6 :: Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals6 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
6 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5)
Int
_ -> Bool
False
equals7 :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals7 :: Char
-> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals7 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 !Char
c6 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
7 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5) Bool -> Bool -> Bool
&&
Char
c6 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
6)
Int
_ -> Bool
False
equals8 :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals8 :: Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Bytes
-> Bool
equals8 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 !Char
c6 !Char
c7 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
8 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5) Bool -> Bool -> Bool
&&
Char
c6 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
6) Bool -> Bool -> Bool
&&
Char
c7 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
7)
Int
_ -> Bool
False
equals9 :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals9 :: Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Bytes
-> Bool
equals9 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 !Char
c6 !Char
c7 !Char
c8 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
9 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5) Bool -> Bool -> Bool
&&
Char
c6 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
6) Bool -> Bool -> Bool
&&
Char
c7 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
7) Bool -> Bool -> Bool
&&
Char
c8 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
8)
Int
_ -> Bool
False
equals10 :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals10 :: Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Bytes
-> Bool
equals10 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 !Char
c6 !Char
c7 !Char
c8 !Char
c9 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
10 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5) Bool -> Bool -> Bool
&&
Char
c6 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
6) Bool -> Bool -> Bool
&&
Char
c7 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
7) Bool -> Bool -> Bool
&&
Char
c8 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
8) Bool -> Bool -> Bool
&&
Char
c9 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
9)
Int
_ -> Bool
False
equals11 :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals11 :: Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Bytes
-> Bool
equals11 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 !Char
c6 !Char
c7 !Char
c8 !Char
c9 !Char
c10 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
11 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5) Bool -> Bool -> Bool
&&
Char
c6 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
6) Bool -> Bool -> Bool
&&
Char
c7 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
7) Bool -> Bool -> Bool
&&
Char
c8 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
8) Bool -> Bool -> Bool
&&
Char
c9 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
9) Bool -> Bool -> Bool
&&
Char
c10 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
10)
Int
_ -> Bool
False
equals12 :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals12 :: Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Bytes
-> Bool
equals12 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 !Char
c6 !Char
c7 !Char
c8 !Char
c9 !Char
c10 !Char
c11 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
12 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5) Bool -> Bool -> Bool
&&
Char
c6 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
6) Bool -> Bool -> Bool
&&
Char
c7 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
7) Bool -> Bool -> Bool
&&
Char
c8 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
8) Bool -> Bool -> Bool
&&
Char
c9 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
9) Bool -> Bool -> Bool
&&
Char
c10 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
10) Bool -> Bool -> Bool
&&
Char
c11 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
11)
Int
_ -> Bool
False
equals13 :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals13 :: Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Bytes
-> Bool
equals13 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 !Char
c6 !Char
c7 !Char
c8 !Char
c9 !Char
c10 !Char
c11 !Char
c12 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
13 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5) Bool -> Bool -> Bool
&&
Char
c6 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
6) Bool -> Bool -> Bool
&&
Char
c7 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
7) Bool -> Bool -> Bool
&&
Char
c8 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
8) Bool -> Bool -> Bool
&&
Char
c9 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
9) Bool -> Bool -> Bool
&&
Char
c10 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
10) Bool -> Bool -> Bool
&&
Char
c11 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
11) Bool -> Bool -> Bool
&&
Char
c12 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
12)
Int
_ -> Bool
False
equals14 :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals14 :: Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Bytes
-> Bool
equals14 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 !Char
c6 !Char
c7 !Char
c8 !Char
c9 !Char
c10 !Char
c11 !Char
c12 !Char
c13 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
14 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5) Bool -> Bool -> Bool
&&
Char
c6 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
6) Bool -> Bool -> Bool
&&
Char
c7 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
7) Bool -> Bool -> Bool
&&
Char
c8 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
8) Bool -> Bool -> Bool
&&
Char
c9 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
9) Bool -> Bool -> Bool
&&
Char
c10 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
10) Bool -> Bool -> Bool
&&
Char
c11 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
11) Bool -> Bool -> Bool
&&
Char
c12 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
12) Bool -> Bool -> Bool
&&
Char
c13 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
13)
Int
_ -> Bool
False
equals15 :: Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Bytes -> Bool
equals15 :: Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Char
-> Bytes
-> Bool
equals15 !Char
c0 !Char
c1 !Char
c2 !Char
c3 !Char
c4 !Char
c5 !Char
c6 !Char
c7 !Char
c8 !Char
c9 !Char
c10 !Char
c11 !Char
c12 !Char
c13 !Char
c14 (Bytes ByteArray
arr Int
off Int
len) = case Int
len of
Int
15 -> Char
c0 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr Int
off Bool -> Bool -> Bool
&&
Char
c1 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
1) Bool -> Bool -> Bool
&&
Char
c2 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
2) Bool -> Bool -> Bool
&&
Char
c3 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
3) Bool -> Bool -> Bool
&&
Char
c4 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
4) Bool -> Bool -> Bool
&&
Char
c5 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
5) Bool -> Bool -> Bool
&&
Char
c6 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
6) Bool -> Bool -> Bool
&&
Char
c7 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
7) Bool -> Bool -> Bool
&&
Char
c8 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
8) Bool -> Bool -> Bool
&&
Char
c9 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
9) Bool -> Bool -> Bool
&&
Char
c10 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
10) Bool -> Bool -> Bool
&&
Char
c11 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
11) Bool -> Bool -> Bool
&&
Char
c12 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
12) Bool -> Bool -> Bool
&&
Char
c13 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
13) Bool -> Bool -> Bool
&&
Char
c14 forall a. Eq a => a -> a -> Bool
== ByteArray -> Int -> Char
indexCharArray ByteArray
arr (Int
off forall a. Num a => a -> a -> a
+ Int
14)
Int
_ -> Bool
False
indexCharArray :: ByteArray -> Int -> Char
indexCharArray :: ByteArray -> Int -> Char
indexCharArray (ByteArray ByteArray#
arr) (I# Int#
off) = Char# -> Char
C# (ByteArray# -> Int# -> Char#
Exts.indexCharArray# ByteArray#
arr Int#
off)
decodeDecWord :: Bytes -> Maybe Word
{-# inline decodeDecWord #-}
decodeDecWord :: Bytes -> Maybe Word
decodeDecWord !Bytes
b = case Bytes -> (# (# #) | Word# #)
decWordStart Bytes
b of
(# (# #) | #) -> forall a. Maybe a
Nothing
(# | Word#
w #) -> forall a. a -> Maybe a
Just (Word# -> Word
W# Word#
w)
decWordStart ::
Bytes
-> (# (# #) | Word# #)
{-# noinline decWordStart #-}
decWordStart :: Bytes -> (# (# #) | Word# #)
decWordStart !Bytes
chunk0 = if Bytes -> Int
length Bytes
chunk0 forall a. Ord a => a -> a -> Bool
> Int
0
then
let !w :: Word
w = forall a b. (Integral a, Num b) => a -> b
fromIntegral @Word8 @Word
(forall a. Prim a => ByteArray -> Int -> a
PM.indexByteArray (Bytes -> ByteArray
array Bytes
chunk0) (Bytes -> Int
offset Bytes
chunk0)) forall a. Num a => a -> a -> a
- Word
48
in if Word
w forall a. Ord a => a -> a -> Bool
< Word
10
then Word -> Bytes -> (# (# #) | Word# #)
decWordMore Word
w (Int -> Bytes -> Bytes
Bytes.unsafeDrop Int
1 Bytes
chunk0)
else (# (# #) | #)
else (# (# #) | #)
where
decWordMore ::
Word
-> Bytes
-> (# (# #) | Word# #)
decWordMore :: Word -> Bytes -> (# (# #) | Word# #)
decWordMore !Word
acc !Bytes
chunk = let len :: Int
len = Bytes -> Int
length Bytes
chunk in case Int
len of
Int
0 -> (# | Word -> Word#
unW (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
acc) #)
Int
_ ->
let !w :: Word
w = forall a b. (Integral a, Num b) => a -> b
fromIntegral @Word8 @Word
(forall a. Prim a => ByteArray -> Int -> a
PM.indexByteArray (Bytes -> ByteArray
array Bytes
chunk) (Bytes -> Int
offset Bytes
chunk)) forall a. Num a => a -> a -> a
- Word
48
in if Word
w forall a. Ord a => a -> a -> Bool
< Word
10
then
let (Bool
overflow,Word
acc') = Word -> Word -> (Bool, Word)
unsignedPushBase10 Word
acc Word
w
in if Bool
overflow
then (# (# #) | #)
else Word -> Bytes -> (# (# #) | Word# #)
decWordMore Word
acc' (Int -> Bytes -> Bytes
Bytes.unsafeDrop Int
1 Bytes
chunk)
else (# (# #) | #)
unsignedPushBase10 :: Word -> Word -> (Bool,Word)
{-# inline unsignedPushBase10 #-}
unsignedPushBase10 :: Word -> Word -> (Bool, Word)
unsignedPushBase10 (W# Word#
a) (W# Word#
b) =
let !(# Word#
ca, Word#
r0 #) = Word# -> Word# -> (# Word#, Word# #)
Exts.timesWord2# Word#
a Word#
10##
!r1 :: Word#
r1 = Word# -> Word# -> Word#
Exts.plusWord# Word#
r0 Word#
b
!cb :: Word#
cb = Int# -> Word#
int2Word# (Word# -> Word# -> Int#
ltWord# Word#
r1 Word#
r0)
!c :: Word#
c = Word#
ca Word# -> Word# -> Word#
`or#` Word#
cb
in (case Word#
c of { Word#
0## -> Bool
False; Word#
_ -> Bool
True }, Word# -> Word
W# Word#
r1)
unW :: Word -> Word#
{-# inline unW #-}
unW :: Word -> Word#
unW (W# Word#
w) = Word#
w