summaryrefslogtreecommitdiff
path: root/src/Data/Bitfield.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Bitfield.hs')
-rw-r--r--src/Data/Bitfield.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Data/Bitfield.hs b/src/Data/Bitfield.hs
index 18f80a4e..11897786 100644
--- a/src/Data/Bitfield.hs
+++ b/src/Data/Bitfield.hs
@@ -160,7 +160,7 @@ completeness :: Bitfield -> Ratio PieceCount
160completeness b = haveCount b % totalCount b 160completeness b = haveCount b % totalCount b
161 161
162inRange :: PieceIx -> Bitfield -> Bool 162inRange :: PieceIx -> Bitfield -> Bool
163inRange ix bf @ Bitfield {..} = 0 <= ix && ix < bfSize 163inRange ix Bitfield {..} = 0 <= ix && ix < bfSize
164 164
165member :: PieceIx -> Bitfield -> Bool 165member :: PieceIx -> Bitfield -> Bool
166member ix bf @ Bitfield {..} 166member ix bf @ Bitfield {..}
@@ -319,11 +319,11 @@ data StartegyClass
319strategyClass :: Ratio PieceCount -> Bitfield -> StartegyClass 319strategyClass :: Ratio PieceCount -> Bitfield -> StartegyClass
320strategyClass threshold = classify . completeness 320strategyClass threshold = classify . completeness
321 where 321 where
322 classify have 322 classify c
323 | have < threshold = SCBeginning 323 | c < threshold = SCBeginning
324 | have + 1 % numerator have < 1 = SCReady 324 | c + 1 % numerator c < 1 = SCReady
325 -- FIXME numerator have is not total count 325 -- FIXME numerator have is not total count
326 | otherwise = SCEnd 326 | otherwise = SCEnd
327 327
328 328
329-- | Select the first available piece. 329-- | Select the first available piece.