We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d161463 commit b4437edCopy full SHA for b4437ed
src/Kyu5/IpsBetween.hs
@@ -1,5 +1,6 @@
1
module Kyu5.IpsBetween where
2
3
+import Data.Bits
4
import Data.List.Split (splitOn)
5
6
type Ipv4 = String
@@ -8,4 +9,4 @@ ipsBetween :: Ipv4 -> Ipv4 -> Int
8
9
ipsBetween from to = to32Bit to - to32Bit from
10
11
to32Bit :: Ipv4 -> Int
-to32Bit ip = foldl (\acc x -> acc * 256 + x) 0 $ map read $ splitOn "." ip
12
+to32Bit ip = foldl (\acc x -> acc `shiftL` 8 .|. x) 0 $ map read $ splitOn "." ip
0 commit comments