X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcodeGen%2FBitmap.hs;h=3b363fd24e5b18591b5bd7972afb3d74fa2fb03e;hb=6ee9554a738c442719ded861504acb729fd3d431;hp=93cf43f639d68c163e8a401142b6313c2b520a17;hpb=49c98d143c382a1341e1046f5ca00819a25691ba;p=ghc-hetmet.git diff --git a/compiler/codeGen/Bitmap.hs b/compiler/codeGen/Bitmap.hs index 93cf43f..3b363fd 100644 --- a/compiler/codeGen/Bitmap.hs +++ b/compiler/codeGen/Bitmap.hs @@ -1,3 +1,10 @@ +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + -- -- (c) The University of Glasgow 2003-2006 -- @@ -9,7 +16,8 @@ module Bitmap ( Bitmap, mkBitmap, intsToBitmap, intsToReverseBitmap, - mAX_SMALL_BITMAP_SIZE + mAX_SMALL_BITMAP_SIZE, + seqBitmap, ) where #include "HsVersions.h" @@ -17,6 +25,7 @@ module Bitmap ( import SMRep import Constants +import Util import Data.Bits @@ -38,7 +47,7 @@ chunkToBitmap chunk = foldr (.|.) 0 [ 1 `shiftL` n | (True,n) <- zip chunk [0..] ] -- | Make a bitmap where the slots specified are the /ones/ in the bitmap. --- eg. @[1,2,4], size 4 ==> 0xb@. +-- eg. @[0,1,3], size 4 ==> 0xb@. -- -- The list of @Int@s /must/ be already sorted. intsToBitmap :: Int -> [Int] -> Bitmap @@ -51,7 +60,7 @@ intsToBitmap size slots{- must be sorted -} where (these,rest) = span ( 0x8@ (we leave any bits outside the size as zero, +-- eg. @[0,1,3], size 4 ==> 0x4@ (we leave any bits outside the size as zero, -- just to make the bitmap easier to read). -- -- The list of @Int@s /must/ be already sorted. @@ -78,3 +87,6 @@ mAX_SMALL_BITMAP_SIZE :: Int mAX_SMALL_BITMAP_SIZE | wORD_SIZE == 4 = 27 | otherwise = 58 +seqBitmap :: Bitmap -> a -> a +seqBitmap = seqList +