X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FBlockAlloc.h;fp=ghc%2Frts%2FBlockAlloc.h;h=a121917c212ae48937a9a5257bad4d4733784cef;hb=8d0e9847953007239e2c19dd1987f0a78825b897;hp=1ef18d4dc34aa7ad9ece96926c3eac9431886a1f;hpb=1b233e22a11b5ce340bc0b09e999d9c6e233c176;p=ghc-hetmet.git diff --git a/ghc/rts/BlockAlloc.h b/ghc/rts/BlockAlloc.h index 1ef18d4..a121917 100644 --- a/ghc/rts/BlockAlloc.h +++ b/ghc/rts/BlockAlloc.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: BlockAlloc.h,v 1.3 1999/01/13 17:25:38 simonm Exp $ + * $Id: BlockAlloc.h,v 1.4 1999/02/03 16:32:47 simonm Exp $ * * Block Allocator Interface * @@ -32,6 +32,23 @@ static inline bdescr *Bdescr(StgPtr p) ); } +/* Round a value to megablocks --------------------------------------------- */ + +#define WORDS_PER_MBLOCK (BLOCKS_PER_MBLOCK * BLOCK_SIZE_W) + +static inline nat +round_to_mblocks(nat words) +{ + if (words > WORDS_PER_MBLOCK) { + if ((words % WORDS_PER_MBLOCK) < (WORDS_PER_MBLOCK / 2)) { + words = (words / WORDS_PER_MBLOCK) * WORDS_PER_MBLOCK; + } else { + words = ((words / WORDS_PER_MBLOCK) + 1) * WORDS_PER_MBLOCK; + } + } + return words; +} + /* Debugging -------------------------------------------------------------- */ #ifdef DEBUG