summaryrefslogtreecommitdiff
path: root/src/Data/Torrent.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Torrent.hs')
-rw-r--r--src/Data/Torrent.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index c3753d4f..5678d7eb 100644
--- a/src/Data/Torrent.hs
+++ b/src/Data/Torrent.hs
@@ -222,10 +222,12 @@ instance BEncodable FileInfo where
222 222
223 fromBEncode _ = decodingError "FileInfo" 223 fromBEncode _ = decodingError "FileInfo"
224 224
225sizeInBase :: Integer -> Int -> Int 225sizeInBase :: Integral a => a -> Int -> Int
226sizeInBase n b = fromIntegral (n `div` fromIntegral b) + align 226sizeInBase n b = fromIntegral (n `div` fromIntegral b) + align
227 where 227 where
228 align = if n `mod` fromIntegral b == 0 then 0 else 1 228 align = if n `mod` fromIntegral b == 0 then 0 else 1
229{-# SPECIALIZE sizeInBase :: Int -> Int -> Int #-}
230{-# SPECIALIZE sizeInBase :: Integer -> Int -> Int #-}
229 231
230contentLength :: ContentInfo -> Integer 232contentLength :: ContentInfo -> Integer
231contentLength SingleFile { ciLength = len } = len 233contentLength SingleFile { ciLength = len } = len