[project @ 2002-07-17 09:21:48 by simonmar]
[ghc-hetmet.git] / ghc / rts / Storage.c
index d0cbb1e..f7a321d 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.65 2002/04/30 09:26:14 simonmar Exp $
+ * $Id: Storage.c,v 1.67 2002/07/17 09:21:51 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -26,6 +26,9 @@
 
 #include "RetainerProfile.h"   // for counting memory blocks (memInventory)
 
+#include <stdlib.h>
+#include <string.h>
+
 #ifdef darwin_TARGET_OS
 #include <mach-o/getsect.h>
 unsigned long macho_etext = 0;
@@ -618,10 +621,8 @@ stgAllocForGMP (size_t size_in_bytes)
   StgArrWords* arr;
   nat data_size_in_words, total_size_in_words;
   
-  /* should be a multiple of sizeof(StgWord) (whole no. of limbs) */
-  ASSERT(size_in_bytes % sizeof(W_) == 0);
-  
-  data_size_in_words  = size_in_bytes / sizeof(W_);
+  /* round up to a whole number of words */
+  data_size_in_words  = (size_in_bytes + sizeof(W_) + 1) / sizeof(W_);
   total_size_in_words = sizeofW(StgArrWords) + data_size_in_words;
   
   /* allocate and fill it in. */