diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2021-03-05 12:01:22 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2021-03-05 12:01:22 +0300 |
commit | 4234d94907af0bb2d8977016b55ef37599bc617e (patch) | |
tree | 0fd38c8de95eab7e794d7496d6ee3a16c9cda3c2 /src/Utils.hs | |
parent | 732781f4ae2d3b20d13fec790c9585e3524b18b8 (diff) | |
download | suem-4234d94907af0bb2d8977016b55ef37599bc617e.tar suem-4234d94907af0bb2d8977016b55ef37599bc617e.tar.xz suem-4234d94907af0bb2d8977016b55ef37599bc617e.zip |
New way of deciphering.
Diffstat (limited to 'src/Utils.hs')
-rw-r--r-- | src/Utils.hs | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/Utils.hs b/src/Utils.hs index 475821a..03d6db3 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -1,7 +1,6 @@ -- This module describes utility functions. module Utils where -import Prelude hiding (Word) import Data.Bits @@ -15,32 +14,8 @@ toBit False = 0 toBits :: Bits a => a -> [Int] -> [Int] toBits x r = map (toBit . testBit x) r -toBitsWhole :: FiniteBits a => a -> [Int] -toBitsWhole x = toBits x [0..(finiteBitSize x - 1)] - fromBits :: [Int] -> Int fromBits = foldl (\a b -> 2 * a + b) 0 . reverse extractBits :: Bits a => a -> [Int] -> Int extractBits x r = fromBits $ toBits x r - - -------------------------------------------------------------------------------- --- Transformers for commands arguments - -args2 :: (Int -> Int -> t) -> - [Int] -> [Int] -> t -args2 f a b = f (fromBits a) (fromBits b) - -args3 :: (Int -> Int -> Int -> t) -> - [Int] -> [Int] -> [Int] -> t -args3 f a b c = f (fromBits a) (fromBits b) (fromBits c) - -args4 :: (Int -> Int -> Int -> Int -> t) -> - [Int] -> [Int] -> [Int] -> [Int] -> t -args4 f a b c d = f (fromBits a) (fromBits b) (fromBits c) (fromBits d) - -args5 :: (Int -> Int -> Int -> Int -> Int -> t) -> - [Int] -> [Int] -> [Int] -> [Int] -> [Int] -> t -args5 f a b c d e = f (fromBits a) (fromBits b) (fromBits c) - (fromBits d) (fromBits e) |