aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.hs
diff options
context:
space:
mode:
authorNikita Orlov <nikitf-97@mail.ru>2021-04-02 15:34:54 +0300
committerNikita Orlov <nikitf-97@mail.ru>2021-04-02 15:34:54 +0300
commita2d59f5e1aa353f29cc557a60646c7a37cb738f4 (patch)
tree24ccb63340923ca14865f4ef19334420e1e28ee7 /src/Utils.hs
parent0ecc75b1134d221f544653025150948f0ac2a743 (diff)
downloadsuem-a2d59f5e1aa353f29cc557a60646c7a37cb738f4.tar
suem-a2d59f5e1aa353f29cc557a60646c7a37cb738f4.tar.xz
suem-a2d59f5e1aa353f29cc557a60646c7a37cb738f4.zip
Operand code update
Diffstat (limited to 'src/Utils.hs')
-rw-r--r--src/Utils.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Utils.hs b/src/Utils.hs
index 82b31ca..cffcc11 100644
--- a/src/Utils.hs
+++ b/src/Utils.hs
@@ -25,15 +25,15 @@ extractBits x r = fromBits $ toBits x r
-------------------------------------------------------------------------------
-- Size Convertion
-convertLong :: Word32 -> Int -> Word32
+convertLong :: Word32 -> Word32 -> Word32
convertLong x 1 = x .&. 0x000000FF
convertLong x 2 = x .&. 0x0000FFFF
-convertLong x 3 = x
+convertLong x 4 = x
convertLong _ s = error $ "Wrong size (" ++ show s ++ ") of convertLong"
-combineLong :: Word32 -> Word32 -> Int -> Word32
+combineLong :: Word32 -> Word32 -> Word32 -> Word32
combineLong update base 1 = base .&. 0xFFFFFF00 .|. (convertLong update 1)
combineLong update base 2 = base .&. 0xFFFF0000 .|. (convertLong update 2)
-combineLong update _ 3 = update
+combineLong update _ 4 = update
combineLong _ _ s = error $
"Wrong size (" ++ show s ++ ") of combineLong"