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 #-}
19 --ADR: The fixity for .|. conflicts with that for .|. in Fran.
20 -- Removing all fixities is a fairly safe fix; fixing the "one fixity
21 -- per symbol per program" limitation in Hugs would take a lot longer.
23 infixl 8 `shift`, `rotate`
30 (.&.), (.|.), xor :: a -> a -> a
32 shift :: a -> Int -> a
33 rotate :: a -> Int -> a
35 setBit :: a -> Int -> a
36 clearBit :: a -> Int -> a
37 complementBit :: a -> Int -> a
38 testBit :: a -> Int -> Bool
42 shiftL, shiftR :: Bits a => a -> Int -> a
43 rotateL, rotateR :: Bits a => a -> Int -> a
44 shiftL a i = shift a i
45 shiftR a i = shift a (-i)
46 rotateL a i = rotate a i
47 rotateR a i = rotate a (-i)