module XMonad.Util.Rectangle
(
PointRectangle (..)
, pixelsToIndices, pixelsToCoordinates
, indicesToRectangle, coordinatesToRectangle
, empty
, intersects
, supersetOf
, difference
, withBorder
, center
, toRatio
) where
import XMonad
import XMonad.Prelude (fi)
import qualified XMonad.StackSet as W
import Data.Ratio
data PointRectangle a = PointRectangle
{ forall a. PointRectangle a -> a
point_x1::a
, forall a. PointRectangle a -> a
point_y1::a
, forall a. PointRectangle a -> a
point_x2::a
, forall a. PointRectangle a -> a
point_y2::a
} deriving (PointRectangle a -> PointRectangle a -> Bool
(PointRectangle a -> PointRectangle a -> Bool)
-> (PointRectangle a -> PointRectangle a -> Bool)
-> Eq (PointRectangle a)
forall a. Eq a => PointRectangle a -> PointRectangle a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => PointRectangle a -> PointRectangle a -> Bool
== :: PointRectangle a -> PointRectangle a -> Bool
$c/= :: forall a. Eq a => PointRectangle a -> PointRectangle a -> Bool
/= :: PointRectangle a -> PointRectangle a -> Bool
Eq,ReadPrec [PointRectangle a]
ReadPrec (PointRectangle a)
Int -> ReadS (PointRectangle a)
ReadS [PointRectangle a]
(Int -> ReadS (PointRectangle a))
-> ReadS [PointRectangle a]
-> ReadPrec (PointRectangle a)
-> ReadPrec [PointRectangle a]
-> Read (PointRectangle a)
forall a. Read a => ReadPrec [PointRectangle a]
forall a. Read a => ReadPrec (PointRectangle a)
forall a. Read a => Int -> ReadS (PointRectangle a)
forall a. Read a => ReadS [PointRectangle a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: forall a. Read a => Int -> ReadS (PointRectangle a)
readsPrec :: Int -> ReadS (PointRectangle a)
$creadList :: forall a. Read a => ReadS [PointRectangle a]
readList :: ReadS [PointRectangle a]
$creadPrec :: forall a. Read a => ReadPrec (PointRectangle a)
readPrec :: ReadPrec (PointRectangle a)
$creadListPrec :: forall a. Read a => ReadPrec [PointRectangle a]
readListPrec :: ReadPrec [PointRectangle a]
Read,Int -> PointRectangle a -> ShowS
[PointRectangle a] -> ShowS
PointRectangle a -> String
(Int -> PointRectangle a -> ShowS)
-> (PointRectangle a -> String)
-> ([PointRectangle a] -> ShowS)
-> Show (PointRectangle a)
forall a. Show a => Int -> PointRectangle a -> ShowS
forall a. Show a => [PointRectangle a] -> ShowS
forall a. Show a => PointRectangle a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> PointRectangle a -> ShowS
showsPrec :: Int -> PointRectangle a -> ShowS
$cshow :: forall a. Show a => PointRectangle a -> String
show :: PointRectangle a -> String
$cshowList :: forall a. Show a => [PointRectangle a] -> ShowS
showList :: [PointRectangle a] -> ShowS
Show)
pixelsToIndices :: Rectangle -> PointRectangle Integer
pixelsToIndices :: Rectangle -> PointRectangle Integer
pixelsToIndices (Rectangle Int32
px Int32
py Word32
dx Word32
dy) =
Integer -> Integer -> Integer -> Integer -> PointRectangle Integer
forall a. a -> a -> a -> a -> PointRectangle a
PointRectangle (Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
px)
(Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
py)
(Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
px Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
dx Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
- Integer
1)
(Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
py Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
dy Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
- Integer
1)
pixelsToCoordinates :: Rectangle -> PointRectangle Integer
pixelsToCoordinates :: Rectangle -> PointRectangle Integer
pixelsToCoordinates (Rectangle Int32
px Int32
py Word32
dx Word32
dy) =
Integer -> Integer -> Integer -> Integer -> PointRectangle Integer
forall a. a -> a -> a -> a -> PointRectangle a
PointRectangle (Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
px)
(Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
py)
(Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
px Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
dx)
(Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
py Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
dy)
indicesToRectangle :: PointRectangle Integer -> Rectangle
indicesToRectangle :: PointRectangle Integer -> Rectangle
indicesToRectangle (PointRectangle Integer
x1 Integer
y1 Integer
x2 Integer
y2) =
Int32 -> Int32 -> Word32 -> Word32 -> Rectangle
Rectangle (Integer -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x1)
(Integer -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
y1)
(Integer -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> Word32) -> Integer -> Word32
forall a b. (a -> b) -> a -> b
$ Integer
x2 Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
- Integer
x1 Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Integer
1)
(Integer -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> Word32) -> Integer -> Word32
forall a b. (a -> b) -> a -> b
$ Integer
y2 Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
- Integer
y1 Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Integer
1)
coordinatesToRectangle :: PointRectangle Integer -> Rectangle
coordinatesToRectangle :: PointRectangle Integer -> Rectangle
coordinatesToRectangle (PointRectangle Integer
x1 Integer
y1 Integer
x2 Integer
y2) =
Int32 -> Int32 -> Word32 -> Word32 -> Rectangle
Rectangle (Integer -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x1)
(Integer -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
y1)
(Integer -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> Word32) -> Integer -> Word32
forall a b. (a -> b) -> a -> b
$ Integer
x2 Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
- Integer
x1)
(Integer -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> Word32) -> Integer -> Word32
forall a b. (a -> b) -> a -> b
$ Integer
y2 Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
- Integer
y1)
empty :: Rectangle -> Bool
empty :: Rectangle -> Bool
empty (Rectangle Int32
_ Int32
_ Word32
_ Word32
0) = Bool
True
empty (Rectangle Int32
_ Int32
_ Word32
0 Word32
_) = Bool
True
empty Rectangle{} = Bool
False
intersects :: Rectangle -> Rectangle -> Bool
intersects :: Rectangle -> Rectangle -> Bool
intersects Rectangle
r1 Rectangle
r2 | Rectangle -> Bool
empty Rectangle
r1 Bool -> Bool -> Bool
|| Rectangle -> Bool
empty Rectangle
r2 = Bool
False
| Bool
otherwise = Integer
r1_x1 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
< Integer
r2_x2
Bool -> Bool -> Bool
&& Integer
r1_x2 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
> Integer
r2_x1
Bool -> Bool -> Bool
&& Integer
r1_y1 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
< Integer
r2_y2
Bool -> Bool -> Bool
&& Integer
r1_y2 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
> Integer
r2_y1
where PointRectangle Integer
r1_x1 Integer
r1_y1 Integer
r1_x2 Integer
r1_y2 = Rectangle -> PointRectangle Integer
pixelsToCoordinates Rectangle
r1
PointRectangle Integer
r2_x1 Integer
r2_y1 Integer
r2_x2 Integer
r2_y2 = Rectangle -> PointRectangle Integer
pixelsToCoordinates Rectangle
r2
supersetOf :: Rectangle -> Rectangle -> Bool
supersetOf :: Rectangle -> Rectangle -> Bool
supersetOf Rectangle
r1 Rectangle
r2 = Integer
r1_x1 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
<= Integer
r2_x1
Bool -> Bool -> Bool
&& Integer
r1_y1 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
<= Integer
r2_y1
Bool -> Bool -> Bool
&& Integer
r1_x2 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
>= Integer
r2_x2
Bool -> Bool -> Bool
&& Integer
r1_y2 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
>= Integer
r2_y2
where PointRectangle Integer
r1_x1 Integer
r1_y1 Integer
r1_x2 Integer
r1_y2 = Rectangle -> PointRectangle Integer
pixelsToCoordinates Rectangle
r1
PointRectangle Integer
r2_x1 Integer
r2_y1 Integer
r2_x2 Integer
r2_y2 = Rectangle -> PointRectangle Integer
pixelsToCoordinates Rectangle
r2
difference :: Rectangle -> Rectangle -> [Rectangle]
difference :: Rectangle -> Rectangle -> [Rectangle]
difference Rectangle
r1 Rectangle
r2 | Rectangle
r1 Rectangle -> Rectangle -> Bool
`intersects` Rectangle
r2 = (PointRectangle Integer -> Rectangle)
-> [PointRectangle Integer] -> [Rectangle]
forall a b. (a -> b) -> [a] -> [b]
map PointRectangle Integer -> Rectangle
coordinatesToRectangle ([PointRectangle Integer] -> [Rectangle])
-> [PointRectangle Integer] -> [Rectangle]
forall a b. (a -> b) -> a -> b
$
[[PointRectangle Integer]] -> [PointRectangle Integer]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [[PointRectangle Integer]
rt,[PointRectangle Integer]
rr,[PointRectangle Integer]
rb,[PointRectangle Integer]
rl]
| Bool
otherwise = [Rectangle
r1]
where PointRectangle Integer
r1_x1 Integer
r1_y1 Integer
r1_x2 Integer
r1_y2 = Rectangle -> PointRectangle Integer
pixelsToCoordinates Rectangle
r1
PointRectangle Integer
r2_x1 Integer
r2_y1 Integer
r2_x2 Integer
r2_y2 = Rectangle -> PointRectangle Integer
pixelsToCoordinates Rectangle
r2
rt :: [PointRectangle Integer]
rt = [Integer -> Integer -> Integer -> Integer -> PointRectangle Integer
forall a. a -> a -> a -> a -> PointRectangle a
PointRectangle (Integer -> Integer -> Integer
forall a. Ord a => a -> a -> a
max Integer
r2_x1 Integer
r1_x1) Integer
r1_y1 Integer
r1_x2 Integer
r2_y1 | Integer
r2_y1 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
> Integer
r1_y1 Bool -> Bool -> Bool
&& Integer
r2_y1 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
< Integer
r1_y2]
rr :: [PointRectangle Integer]
rr = [Integer -> Integer -> Integer -> Integer -> PointRectangle Integer
forall a. a -> a -> a -> a -> PointRectangle a
PointRectangle Integer
r2_x2 (Integer -> Integer -> Integer
forall a. Ord a => a -> a -> a
max Integer
r2_y1 Integer
r1_y1) Integer
r1_x2 Integer
r1_y2 | Integer
r2_x2 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
> Integer
r1_x1 Bool -> Bool -> Bool
&& Integer
r2_x2 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
< Integer
r1_x2]
rb :: [PointRectangle Integer]
rb = [Integer -> Integer -> Integer -> Integer -> PointRectangle Integer
forall a. a -> a -> a -> a -> PointRectangle a
PointRectangle Integer
r1_x1 Integer
r2_y2 (Integer -> Integer -> Integer
forall a. Ord a => a -> a -> a
min Integer
r2_x2 Integer
r1_x2) Integer
r1_y2 | Integer
r2_y2 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
> Integer
r1_y1 Bool -> Bool -> Bool
&& Integer
r2_y2 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
< Integer
r1_y2]
rl :: [PointRectangle Integer]
rl = [Integer -> Integer -> Integer -> Integer -> PointRectangle Integer
forall a. a -> a -> a -> a -> PointRectangle a
PointRectangle Integer
r1_x1 Integer
r1_y1 Integer
r2_x1 (Integer -> Integer -> Integer
forall a. Ord a => a -> a -> a
min Integer
r2_y2 Integer
r1_y2) | Integer
r2_x1 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
> Integer
r1_x1 Bool -> Bool -> Bool
&& Integer
r2_x1 Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
< Integer
r1_x2]
withBorder :: Integer
-> Integer
-> Integer
-> Integer
-> Integer
-> Rectangle -> Rectangle
withBorder :: Integer
-> Integer
-> Integer
-> Integer
-> Integer
-> Rectangle
-> Rectangle
withBorder Integer
t Integer
b Integer
r Integer
l Integer
i (Rectangle Int32
x Int32
y Word32
w Word32
h) =
let
w' :: Integer
w' = Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
w
h' :: Integer
h' = Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
h
i' :: Integer
i' = Integer -> Integer -> Integer
forall a. Ord a => a -> a -> a
max Integer
i Integer
0
iw :: Integer
iw = Integer -> Integer -> Integer
forall a. Ord a => a -> a -> a
min Integer
i' Integer
w'
ih :: Integer
ih = Integer -> Integer -> Integer
forall a. Ord a => a -> a -> a
min Integer
i' Integer
h'
bh :: Integer
bh = Integer
w' Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
- Integer
iw
bv :: Integer
bv = Integer
h' Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
- Integer
ih
rh :: Ratio Integer
rh = if Integer
l Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Integer
r Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
<= Integer
0
then Ratio Integer
1
else Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Ord a => a -> a -> a
min Ratio Integer
1 (Ratio Integer -> Ratio Integer) -> Ratio Integer -> Ratio Integer
forall a b. (a -> b) -> a -> b
$ Integer
bh Integer -> Integer -> Ratio Integer
forall a. Integral a => a -> a -> Ratio a
% (Integer
l Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Integer
r)
rv :: Ratio Integer
rv = if Integer
t Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Integer
b Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
<= Integer
0
then Ratio Integer
1
else Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Ord a => a -> a -> a
min Ratio Integer
1 (Ratio Integer -> Ratio Integer) -> Ratio Integer -> Ratio Integer
forall a b. (a -> b) -> a -> b
$ Integer
bv Integer -> Integer -> Ratio Integer
forall a. Integral a => a -> a -> Ratio a
% (Integer
t Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ Integer
b)
t' :: Int32
t' = Ratio Integer -> Int32
forall b. Integral b => Ratio Integer -> b
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Ratio Integer -> Int32) -> Ratio Integer -> Int32
forall a b. (a -> b) -> a -> b
$ Ratio Integer
rv Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Num a => a -> a -> a
* Integer -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
t
b' :: Word32
b' = Ratio Integer -> Word32
forall b. Integral b => Ratio Integer -> b
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Ratio Integer -> Word32) -> Ratio Integer -> Word32
forall a b. (a -> b) -> a -> b
$ Ratio Integer
rv Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Num a => a -> a -> a
* Integer -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
b
r' :: Word32
r' = Ratio Integer -> Word32
forall b. Integral b => Ratio Integer -> b
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Ratio Integer -> Word32) -> Ratio Integer -> Word32
forall a b. (a -> b) -> a -> b
$ Ratio Integer
rh Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Num a => a -> a -> a
* Integer -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
r
l' :: Int32
l' = Ratio Integer -> Int32
forall b. Integral b => Ratio Integer -> b
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Ratio Integer -> Int32) -> Ratio Integer -> Int32
forall a b. (a -> b) -> a -> b
$ Ratio Integer
rh Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Num a => a -> a -> a
* Integer -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
l
in Int32 -> Int32 -> Word32 -> Word32 -> Rectangle
Rectangle (Int32
x Int32 -> Int32 -> Int32
forall a. Num a => a -> a -> a
+ Int32
l')
(Int32
y Int32 -> Int32 -> Int32
forall a. Num a => a -> a -> a
+ Int32
t')
(Word32
w Word32 -> Word32 -> Word32
forall a. Num a => a -> a -> a
- Word32
r' Word32 -> Word32 -> Word32
forall a. Num a => a -> a -> a
- Int32 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
l')
(Word32
h Word32 -> Word32 -> Word32
forall a. Num a => a -> a -> a
- Word32
b' Word32 -> Word32 -> Word32
forall a. Num a => a -> a -> a
- Int32 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
t')
center :: Rectangle -> (Ratio Integer,Ratio Integer)
center :: Rectangle -> (Ratio Integer, Ratio Integer)
center (Rectangle Int32
x Int32
y Word32
w Word32
h) = (Ratio Integer
cx,Ratio Integer
cy)
where cx :: Ratio Integer
cx = Int32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
x Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Num a => a -> a -> a
+ Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
w Integer -> Integer -> Ratio Integer
forall a. Integral a => a -> a -> Ratio a
% Integer
2
cy :: Ratio Integer
cy = Int32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
y Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Num a => a -> a -> a
+ Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
h Integer -> Integer -> Ratio Integer
forall a. Integral a => a -> a -> Ratio a
% Integer
2
toRatio :: Rectangle -> Rectangle -> W.RationalRect
toRatio :: Rectangle -> Rectangle -> RationalRect
toRatio (Rectangle Int32
x1 Int32
y1 Word32
w1 Word32
h1) (Rectangle Int32
x2 Int32
y2 Word32
w2 Word32
h2) =
Ratio Integer
-> Ratio Integer -> Ratio Integer -> Ratio Integer -> RationalRect
W.RationalRect ((Int32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Int32
x1 Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Num a => a -> a -> a
- Int32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Int32
x2) Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Fractional a => a -> a -> a
/ Word32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Word32
w2)
((Int32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Int32
y1 Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Num a => a -> a -> a
- Int32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Int32
y2) Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Fractional a => a -> a -> a
/ Word32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Word32
h2)
(Word32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Word32
w1 Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Fractional a => a -> a -> a
/ Word32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Word32
w2) (Word32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Word32
h1 Ratio Integer -> Ratio Integer -> Ratio Integer
forall a. Fractional a => a -> a -> a
/ Word32 -> Ratio Integer
forall a b. (Integral a, Num b) => a -> b
fi Word32
h2)