Skip to content
Snippets Groups Projects
Commit 618ce063 authored by Nguyen Anh Quynh's avatar Nguyen Anh Quynh
Browse files

Merge pull request #184 from adrianherrera/improvement/haskell-fixes

Minor updates
parents 0d95ba5b 74f3916a
No related branches found
No related tags found
No related merge requests found
......@@ -15,12 +15,12 @@ testKs :: Architecture
-> String
-> Maybe OptionValue
-> IO ()
testKs arch mode assembly syntax = do
testKs arch mode assembly maybeSyntax = do
result <- runAssembler $ do
ks <- open arch mode
case syntax of
Just syn -> option ks OptSyntax syn
Nothing -> return ()
case maybeSyntax of
Just syntax -> option ks OptSyntax syntax
Nothing -> return ()
(encode, count) <- assemble ks assembly Nothing
return (encode, count)
case result of
......
......@@ -7,18 +7,12 @@ License : GPL-2
module Keystone.Internal.Util where
import Data.Bits
import Foreign
-- | Combine a list of Enums by performing a bitwise-OR.
combineEnums :: (Enum a, Num b, Bits b) => [a] -> b
combineEnums =
foldr ((.|.) <$> enumToNum) 0
-- | Cast a pointer and then peek inside it.
castPtrAndPeek :: Storable a => Ptr b -> IO a
castPtrAndPeek =
peek . castPtr
-- | Convert an 'Eum' to a 'Num'.
enumToNum :: (Enum a, Num b) => a -> b
enumToNum =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment