summaryrefslogtreecommitdiff
path: root/includes/rts
diff options
context:
space:
mode:
authorKyrill Briantsev <kyrab@mail.ru>2014-03-12 14:31:21 -0500
committerAustin Seipp <austin@well-typed.com>2014-03-13 17:56:36 -0500
commitb7e5d722c6811f34253d8202540dd9b0ec1b6766 (patch)
tree060a19f096e010b49422a3dcab5d86599acf8907 /includes/rts
parent623883f1ed0ee11cc925c4590fb09565403fd231 (diff)
downloadhaskell-b7e5d722c6811f34253d8202540dd9b0ec1b6766.tar.gz
Fix incorrect blocksize calculation on Win64
Fixes #8839 Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'includes/rts')
-rw-r--r--includes/rts/storage/Block.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/includes/rts/storage/Block.h b/includes/rts/storage/Block.h
index 5567bf455a..29c081bba8 100644
--- a/includes/rts/storage/Block.h
+++ b/includes/rts/storage/Block.h
@@ -9,16 +9,26 @@
#ifndef RTS_STORAGE_BLOCK_H
#define RTS_STORAGE_BLOCK_H
+#include "ghcconfig.h"
+
/* The actual block and megablock-size constants are defined in
* includes/Constants.h, all constants here are derived from these.
*/
/* Block related constants (BLOCK_SHIFT is defined in Constants.h) */
+#if SIZEOF_LONG == SIZEOF_VOID_P
+#define UNIT 1UL
+#elif SIZEOF_LONG_LONG == SIZEOF_VOID_P
+#define UNIT 1ULL
+#else
+#error "Size of pointer is suspicious."
+#endif
+
#ifdef CMINUSMINUS
#define BLOCK_SIZE (1<<BLOCK_SHIFT)
#else
-#define BLOCK_SIZE (1UL<<BLOCK_SHIFT)
+#define BLOCK_SIZE (UNIT<<BLOCK_SHIFT)
// Note [integer overflow]
#endif
@@ -33,7 +43,7 @@
#ifdef CMINUSMINUS
#define MBLOCK_SIZE (1<<MBLOCK_SHIFT)
#else
-#define MBLOCK_SIZE (1UL<<MBLOCK_SHIFT)
+#define MBLOCK_SIZE (UNIT<<MBLOCK_SHIFT)
// Note [integer overflow]
#endif