[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / compiler / utils / BitSet.lhs
index 7af5ff9..22afea6 100644 (file)
@@ -1,5 +1,5 @@
 %
-% (c) The GRASP Project, Glasgow University, 1994-1995
+% (c) The GRASP Project, Glasgow University, 1994-1998
 %
 \section[BitSet]{An implementation of very small sets}
 
@@ -19,16 +19,11 @@ Integer and get virtually unlimited sets.
 module BitSet (
        BitSet,         -- abstract type
        mkBS, listBS, emptyBS, unitBS,
-       unionBS, minusBS
-#if ! defined(COMPILING_GHC)
-       , elementBS, intersectBS, isEmptyBS
-#endif
+       unionBS, minusBS, intBS
     ) where
 
 #ifdef __GLASGOW_HASKELL__
-#if __GLASGOW_HASKELL__ >= 202
 import GlaExts
-#endif
 -- nothing to import
 #elif defined(__YALE_HASKELL__)
 {-hide import from mkdependHS-}
@@ -60,7 +55,7 @@ unionBS (MkBS x#) (MkBS y#) = MkBS (x# `or#` y#)
 minusBS :: BitSet -> BitSet -> BitSet
 minusBS (MkBS x#) (MkBS y#) = MkBS (x# `and#` (not# y#))
 
-#if ! defined(COMPILING_GHC)
+#if 0
 -- not used in GHC
 isEmptyBS :: BitSet -> Bool
 isEmptyBS (MkBS s#)
@@ -90,6 +85,10 @@ listBS s = listify s 0
                          _  -> n : more
          shiftr x y = shiftRL# x y
 
+-- intBS is a bit naughty.
+intBS :: BitSet -> Int
+intBS (MkBS w#) = I# (word2Int# w#)
+
 #elif defined(__YALE_HASKELL__)
 
 data BitSet = MkBS Int
@@ -106,7 +105,7 @@ unitBS x = MkBS (1 `ashInt` x)
 unionBS :: BitSet -> BitSet -> BitSet
 unionBS (MkBS x) (MkBS y) = MkBS (x `logiorInt` y)
 
-#if ! defined(COMPILING_GHC)
+#if 0
 -- not used in GHC
 isEmptyBS :: BitSet -> Bool
 isEmptyBS (MkBS s)
@@ -155,7 +154,7 @@ unitBS x = MkBS (1 `bitLsh` x)
 unionBS :: BitSet -> BitSet -> BitSet
 unionBS (MkBS x) (MkBS y) = MkBS (x `bitOr` y)
 
-#if ! defined(COMPILING_GHC)
+#if 0
 -- not used in GHC
 isEmptyBS :: BitSet -> Bool
 isEmptyBS (MkBS s)