September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,18 +1,24 @@
import Data.Bits
bitwise :: Int -> Int -> IO ()
bitwise a b = do
print $ a .&. b
print $ a .|. b
print $ a `xor` b
print $ complement a
print $ shiftL a b -- left shift
print $ shiftR a b -- arithmetic right shift
print $ shift a b -- You can also use the "unified" shift function; positive is for left shift, negative is for right shift
print $ shift a (-b)
print $ rotateL a b -- rotate left
print $ rotateR a b -- rotate right
print $ rotate a b -- You can also use the "unified" rotate function; positive is for left rotate, negative is for right rotate
print $ rotate a (-b)
bitwise a b =
mapM_
print
[ a .&. b
, a .|. b
, a `xor` b
, complement a
, shiftL a b -- left shift
, shiftR a b -- arithmetic right shift
, shift a b -- You can also use the "unified" shift function;
-- positive is for left shift, negative is for right shift
, shift a (-b)
, rotateL a b -- rotate left
, rotateR a b -- rotate right
, rotate a b -- You can also use the "unified" rotate function;
-- positive is for left rotate, negative is for right rotate
, rotate a (-b)
]
main :: IO ()
main = bitwise 255 170