module Control.Concurrent.Chan.Unagi.Constants
where
import Data.Bits
import Control.Exception(assert)
divMod_sEGMENT_LENGTH :: Int -> (Int,Int)
{-# INLINE divMod_sEGMENT_LENGTH #-}
divMod_sEGMENT_LENGTH :: Int -> (Int, Int)
divMod_sEGMENT_LENGTH Int
n = let d :: Int
d = Int
n Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`unsafeShiftR` Int
lOG_SEGMENT_LENGTH
m :: Int
m = Int
n Int -> Int -> Int
forall a. Bits a => a -> a -> a
.&. Int
sEGMENT_LENGTH_MN_1
in Int
d Int -> (Int, Int) -> (Int, Int)
`seq` Int
m Int -> (Int, Int) -> (Int, Int)
`seq` (Int
d,Int
m)
sEGMENT_LENGTH :: Int
{-# INLINE sEGMENT_LENGTH #-}
sEGMENT_LENGTH :: Int
sEGMENT_LENGTH = Int
1024
nEW_SEGMENT_WAIT :: Int
nEW_SEGMENT_WAIT :: Int
nEW_SEGMENT_WAIT = Float -> Int
forall a b. (RealFrac a, Integral b) => a -> b
round (((Float
14.6::Float) Float -> Float -> Float
forall a. Num a => a -> a -> a
+ Float
0.3Float -> Float -> Float
forall a. Num a => a -> a -> a
*Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
sEGMENT_LENGTH) Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
3.7) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
10
lOG_SEGMENT_LENGTH :: Int
lOG_SEGMENT_LENGTH :: Int
lOG_SEGMENT_LENGTH =
let x :: Int
x = Int
10
in Bool -> Int -> Int
forall a. (?callStack::CallStack) => Bool -> a -> a
assert (Int
x Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== (Float -> Int
forall a b. (RealFrac a, Integral b) => a -> b
round (Float -> Int) -> Float -> Int
forall a b. (a -> b) -> a -> b
$ Float -> Float -> Float
forall a. Floating a => a -> a -> a
logBase (Float
2::Float) (Float -> Float) -> Float -> Float
forall a b. (a -> b) -> a -> b
$ Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
sEGMENT_LENGTH))
Int
x
sEGMENT_LENGTH_MN_1 :: Int
sEGMENT_LENGTH_MN_1 :: Int
sEGMENT_LENGTH_MN_1 = Int
sEGMENT_LENGTH Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1