X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Futils%2FBitSet.lhs;h=a108136af3708c20a6e4e233010f5ef5a23cbcda;hb=9fa1f25e41b0b35bb8aeff7639cccc6f6abcaec6;hp=bc4ea14c1792d06c056c70eab67b55ecc88911a9;hpb=580a1e579a16df8cf80867badba8c43a1760fb02;p=ghc-hetmet.git diff --git a/ghc/compiler/utils/BitSet.lhs b/ghc/compiler/utils/BitSet.lhs index bc4ea14..a108136 100644 --- a/ghc/compiler/utils/BitSet.lhs +++ b/ghc/compiler/utils/BitSet.lhs @@ -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,13 +19,13 @@ Integer and get virtually unlimited sets. module BitSet ( BitSet, -- abstract type mkBS, listBS, emptyBS, unitBS, - unionBS, minusBS + unionBS, minusBS, intBS ) where +#include "HsVersions.h" + #ifdef __GLASGOW_HASKELL__ -#if __GLASGOW_HASKELL__ >= 202 -import GlaExts -#endif +import GLAEXTS -- nothing to import #elif defined(__YALE_HASKELL__) {-hide import from mkdependHS-} @@ -49,7 +49,11 @@ mkBS xs = foldr (unionBS . unitBS) emptyBS xs unitBS :: Int -> BitSet unitBS x = case x of +#if __GLASGOW_HASKELL__ >= 503 + I# i# -> MkBS ((int2Word# 1#) `uncheckedShiftL#` i#) +#else I# i# -> MkBS ((int2Word# 1#) `shiftL#` i#) +#endif unionBS :: BitSet -> BitSet -> BitSet unionBS (MkBS x#) (MkBS y#) = MkBS (x# `or#` y#) @@ -85,7 +89,15 @@ listBS s = listify s 0 in case word2Int# (s# `and#` (int2Word# 1#)) of 0# -> more _ -> n : more +#if __GLASGOW_HASKELL__ >= 503 + shiftr x y = uncheckedShiftRL# x y +#else shiftr x y = shiftRL# x y +#endif + +-- intBS is a bit naughty. +intBS :: BitSet -> Int +intBS (MkBS w#) = I# (word2Int# w#) #elif defined(__YALE_HASKELL__)