2 % (c) The GRASP/AQUA Project, Glasgow University, 1998
4 \section[Bits]{The @Bits@ interface}
6 Defines the @Bits@ class containing bit-based operations.
7 See library document for details on the semantics of the
11 {-# OPTIONS -fno-implicit-prelude #-}
21 --ADR: The fixity for .|. conflicts with that for .|. in Fran.
22 -- Removing all fixities is a fairly safe fix; fixing the "one fixity
23 -- per symbol per program" limitation in Hugs would take a lot longer.
25 infixl 8 `shift`, `rotate`
32 (.&.), (.|.), xor :: a -> a -> a
34 shift :: a -> Int -> a
35 rotate :: a -> Int -> a
37 setBit :: a -> Int -> a
38 clearBit :: a -> Int -> a
39 complementBit :: a -> Int -> a
40 testBit :: a -> Int -> Bool
44 shiftL, shiftR :: Bits a => a -> Int -> a
45 rotateL, rotateR :: Bits a => a -> Int -> a
46 shiftL a i = shift a i
47 shiftR a i = shift a (-i)
48 rotateL a i = rotate a i
49 rotateR a i = rotate a (-i)