aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorDavid Lovemore2012-05-03 16:38:47 +0100
committerDavid Lovemore2012-05-03 16:38:47 +0100
commit9bf482ea08a4800df14251b30422a8cb9faf85b9 (patch)
treed296ba55ec6de62431ddb3f31368e1a7a300d125 /mps/code
parent4ee202d5cffd73e73311b889ea1ce51a2b8cc7eb (diff)
downloademacs-9bf482ea08a4800df14251b30422a8cb9faf85b9.tar.gz
emacs-9bf482ea08a4800df14251b30422a8cb9faf85b9.zip
Fixed up long constants and shifts that needed to be cast to correct type.
Copied from Perforce Change: 178095 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/arena.c2
-rw-r--r--mps/code/arenavm.c10
-rw-r--r--mps/code/awlut.c12
-rw-r--r--mps/code/awluthe.c12
-rw-r--r--mps/code/awlutth.c12
-rw-r--r--mps/code/config.h2
-rw-r--r--mps/code/fmtdy.c4
-rw-r--r--mps/code/fmthe.h4
-rw-r--r--mps/code/mpm.c10
-rw-r--r--mps/code/mps.h2
-rw-r--r--mps/code/poolamc.c2
-rw-r--r--mps/code/poolawl.c2
-rw-r--r--mps/code/poollo.c2
-rw-r--r--mps/code/ref.c2
-rw-r--r--mps/code/steptest.c2
-rw-r--r--mps/code/table.c2
-rw-r--r--mps/code/trace.c2
-rw-r--r--mps/code/walkt0.c2
-rw-r--r--mps/code/zcoll.c6
19 files changed, 46 insertions, 46 deletions
diff --git a/mps/code/arena.c b/mps/code/arena.c
index 4436e10ccf5..704d13f60db 100644
--- a/mps/code/arena.c
+++ b/mps/code/arena.c
@@ -172,7 +172,7 @@ Res ArenaInit(Arena arena, ArenaClass class)
172 arena->spareCommitted = (Size)0; 172 arena->spareCommitted = (Size)0;
173 arena->spareCommitLimit = ARENA_INIT_SPARE_COMMIT_LIMIT; 173 arena->spareCommitLimit = ARENA_INIT_SPARE_COMMIT_LIMIT;
174 /* alignment is usually overridden by init */ 174 /* alignment is usually overridden by init */
175 arena->alignment = 1 << ARENA_ZONESHIFT; 175 arena->alignment = (Align)1 << ARENA_ZONESHIFT;
176 /* zoneShift is usually overridden by init */ 176 /* zoneShift is usually overridden by init */
177 arena->zoneShift = ARENA_ZONESHIFT; 177 arena->zoneShift = ARENA_ZONESHIFT;
178 arena->poolReady = FALSE; /* <design/arena/#pool.ready> */ 178 arena->poolReady = FALSE; /* <design/arena/#pool.ready> */
diff --git a/mps/code/arenavm.c b/mps/code/arenavm.c
index 71e828e27c6..2b8a473d6bd 100644
--- a/mps/code/arenavm.c
+++ b/mps/code/arenavm.c
@@ -1631,16 +1631,16 @@ static void VMFree(Addr base, Size size, Pool pool)
1631 * Input: 208896 1631 * Input: 208896
1632 * Output: (Megabytes) 0m209 1632 * Output: (Megabytes) 0m209
1633 */ 1633 */
1634#define bPerM (1000000UL) /* Megabytes */ 1634#define bPerM ((Size)1000000) /* Megabytes */
1635#define bThou (1000UL) 1635#define bThou ((Size)1000)
1636DIAG_DECL( 1636DIAG_DECL(
1637static Count M_whole(size_t bytes) 1637static Count M_whole(Size bytes)
1638{ 1638{
1639 size_t M; /* MBs */ 1639 Count M; /* MBs */
1640 M = (bytes + (bThou / 2)) / bPerM; 1640 M = (bytes + (bThou / 2)) / bPerM;
1641 return M; 1641 return M;
1642} 1642}
1643static Count M_frac(size_t bytes) 1643static Count M_frac(Size bytes)
1644{ 1644{
1645 Count Mthou; /* thousandths of a MB */ 1645 Count Mthou; /* thousandths of a MB */
1646 Mthou = (bytes + (bThou / 2)) / bThou; 1646 Mthou = (bytes + (bThou / 2)) / bThou;
diff --git a/mps/code/awlut.c b/mps/code/awlut.c
index ddcd1c7ab5d..d52abae9030 100644
--- a/mps/code/awlut.c
+++ b/mps/code/awlut.c
@@ -43,9 +43,9 @@ static mps_word_t wrapper_wrapper[] = {
43 UNINIT, /* wrapper */ 43 UNINIT, /* wrapper */
44 UNINIT, /* class */ 44 UNINIT, /* class */
45 0, /* Extra word */ 45 0, /* Extra word */
46 4uL<<2|2, /* F */ 46 (mps_word_t)4<<2|2, /* F */
47 2uL<<(MPS_WORD_WIDTH - 8), /* V */ 47 (mps_word_t)2<<(MPS_WORD_WIDTH - 8), /* V */
48 1uL<<2|1, /* VL */ 48 (mps_word_t)1<<2|1, /* VL */
49 1 /* patterns */ 49 1 /* patterns */
50}; 50};
51 51
@@ -55,7 +55,7 @@ static mps_word_t string_wrapper[] = {
55 UNINIT, /* class */ 55 UNINIT, /* class */
56 0, /* extra word */ 56 0, /* extra word */
57 0, /* F */ 57 0, /* F */
58 2uL<<(MPS_WORD_WIDTH - 8)|3uL<<3|4, /* V */ 58 (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|(mps_word_t)3<<3|4, /* V */
59 1 /* VL */ 59 1 /* VL */
60}; 60};
61 61
@@ -63,8 +63,8 @@ static mps_word_t table_wrapper[] = {
63 UNINIT, /* wrapper */ 63 UNINIT, /* wrapper */
64 UNINIT, /* class */ 64 UNINIT, /* class */
65 0, /* extra word */ 65 0, /* extra word */
66 1uL<<2|1, /* F */ 66 (mps_word_t)1<<2|1, /* F */
67 2uL<<(MPS_WORD_WIDTH - 8)|2, /* V */ 67 (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|2, /* V */
68 1 /* VL */ 68 1 /* VL */
69}; 69};
70 70
diff --git a/mps/code/awluthe.c b/mps/code/awluthe.c
index be40f115b38..d70d12cb342 100644
--- a/mps/code/awluthe.c
+++ b/mps/code/awluthe.c
@@ -44,9 +44,9 @@ static mps_word_t wrapper_wrapper[] = {
44 UNINIT, /* wrapper */ 44 UNINIT, /* wrapper */
45 UNINIT, /* class */ 45 UNINIT, /* class */
46 0, /* Extra word */ 46 0, /* Extra word */
47 4uL<<2|2, /* F */ 47 (mps_word_t)4<<2|2, /* F */
48 2uL<<(MPS_WORD_WIDTH - 8), /* V */ 48 (mps_word_t)2<<(MPS_WORD_WIDTH - 8), /* V */
49 1uL<<2|1, /* VL */ 49 (mps_word_t)1<<2|1, /* VL */
50 1 /* patterns */ 50 1 /* patterns */
51}; 51};
52 52
@@ -56,7 +56,7 @@ static mps_word_t string_wrapper[] = {
56 UNINIT, /* class */ 56 UNINIT, /* class */
57 0, /* extra word */ 57 0, /* extra word */
58 0, /* F */ 58 0, /* F */
59 2uL<<(MPS_WORD_WIDTH - 8)|3uL<<3|4, /* V */ 59 (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|(mps_word_t)3<<3|4, /* V */
60 1 /* VL */ 60 1 /* VL */
61}; 61};
62 62
@@ -64,8 +64,8 @@ static mps_word_t table_wrapper[] = {
64 UNINIT, /* wrapper */ 64 UNINIT, /* wrapper */
65 UNINIT, /* class */ 65 UNINIT, /* class */
66 0, /* extra word */ 66 0, /* extra word */
67 1uL<<2|1, /* F */ 67 (mps_word_t)1<<2|1, /* F */
68 2uL<<(MPS_WORD_WIDTH - 8)|2, /* V */ 68 (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|2, /* V */
69 1 /* VL */ 69 1 /* VL */
70}; 70};
71 71
diff --git a/mps/code/awlutth.c b/mps/code/awlutth.c
index 37a27fc0125..26ef8c2c70d 100644
--- a/mps/code/awlutth.c
+++ b/mps/code/awlutth.c
@@ -45,9 +45,9 @@ static mps_word_t wrapper_wrapper[] = {
45 UNINIT, /* wrapper */ 45 UNINIT, /* wrapper */
46 UNINIT, /* class */ 46 UNINIT, /* class */
47 0, /* Extra word */ 47 0, /* Extra word */
48 4uL<<2|2, /* F */ 48 (mps_word_t)4<<2|2, /* F */
49 2uL<<(MPS_WORD_WIDTH - 8), /* V */ 49 (mps_word_t)2<<(MPS_WORD_WIDTH - 8), /* V */
50 1uL<<2|1, /* VL */ 50 (mps_word_t)1<<2|1, /* VL */
51 1 /* patterns */ 51 1 /* patterns */
52}; 52};
53 53
@@ -57,7 +57,7 @@ static mps_word_t string_wrapper[] = {
57 UNINIT, /* class */ 57 UNINIT, /* class */
58 0, /* extra word */ 58 0, /* extra word */
59 0, /* F */ 59 0, /* F */
60 2uL<<(MPS_WORD_WIDTH - 8)|3uL<<3|4, /* V */ 60 (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|(mps_word_t)3<<3|4, /* V */
61 1 /* VL */ 61 1 /* VL */
62}; 62};
63 63
@@ -65,8 +65,8 @@ static mps_word_t table_wrapper[] = {
65 UNINIT, /* wrapper */ 65 UNINIT, /* wrapper */
66 UNINIT, /* class */ 66 UNINIT, /* class */
67 0, /* extra word */ 67 0, /* extra word */
68 1uL<<2|1, /* F */ 68 (mps_word_t)1<<2|1, /* F */
69 2uL<<(MPS_WORD_WIDTH - 8)|2, /* V */ 69 (mps_word_t)2<<(MPS_WORD_WIDTH - 8)|2, /* V */
70 1 /* VL */ 70 1 /* VL */
71}; 71};
72 72
diff --git a/mps/code/config.h b/mps/code/config.h
index ca6e796e48c..025e775ea88 100644
--- a/mps/code/config.h
+++ b/mps/code/config.h
@@ -193,7 +193,7 @@
193 * design.mps.poolepvm.arch.segment.size. 193 * design.mps.poolepvm.arch.segment.size.
194 */ 194 */
195 195
196#define EPVMDefaultSubsequentSegSIZE (64ul * 1024) 196#define EPVMDefaultSubsequentSegSIZE ((Size)64 * 1024)
197 197
198 198
199/* Arena Configuration -- see <code/arena.c> 199/* Arena Configuration -- see <code/arena.c>
diff --git a/mps/code/fmtdy.c b/mps/code/fmtdy.c
index 1485476394f..ec87c1fa001 100644
--- a/mps/code/fmtdy.c
+++ b/mps/code/fmtdy.c
@@ -247,7 +247,7 @@ extern mps_addr_t dylan_weak_dependent(mps_addr_t parent)
247 ff = fword & 3; 247 ff = fword & 3;
248 /* traceable fixed part */ 248 /* traceable fixed part */
249 assert(ff == 1); 249 assert(ff == 1);
250 fl = fword & ~3uL; 250 fl = fword & ~(mps_word_t)3;
251 /* at least one fixed field */ 251 /* at least one fixed field */
252 assert(fl >= 1); 252 assert(fl >= 1);
253 return (mps_addr_t) object[1]; 253 return (mps_addr_t) object[1];
@@ -354,7 +354,7 @@ static mps_res_t dylan_scan_pat(mps_ss_t mps_ss,
354 354
355#define NONWORD_LENGTH(_vt, _es) \ 355#define NONWORD_LENGTH(_vt, _es) \
356 ((_es) < MPS_WORD_SHIFT ? \ 356 ((_es) < MPS_WORD_SHIFT ? \
357 ((_vt) + (1 << (MPS_WORD_SHIFT - (_es))) - 1) >> \ 357 ((_vt) + ((mps_word_t)1 << (MPS_WORD_SHIFT - (_es))) - 1) >> \
358 (MPS_WORD_SHIFT - (_es)) : \ 358 (MPS_WORD_SHIFT - (_es)) : \
359 (_vt) << ((_es) - MPS_WORD_SHIFT)) 359 (_vt) << ((_es) - MPS_WORD_SHIFT))
360 360
diff --git a/mps/code/fmthe.h b/mps/code/fmthe.h
index 391ead0ef55..369a6b4a926 100644
--- a/mps/code/fmthe.h
+++ b/mps/code/fmthe.h
@@ -21,9 +21,9 @@ extern mps_res_t HeaderWeakFormatCheck(mps_addr_t addr);
21#define realTYPE 0x33 21#define realTYPE 0x33
22#define realHeader (realTYPE + 0x12345600) 22#define realHeader (realTYPE + 0x12345600)
23#define padTYPE 0xaa 23#define padTYPE 0xaa
24#define headerType(header) ((header) & ((1 << headerTypeBits) - 1)) 24#define headerType(header) ((header) & (((mps_word_t)1 << headerTypeBits) - 1))
25#define headerPadSize(header) ((header) >> headerTypeBits) 25#define headerPadSize(header) ((header) >> headerTypeBits)
26#define padHeader(size) ((size << headerTypeBits) | padTYPE) 26#define padHeader(size) (((mps_word_t)size << headerTypeBits) | padTYPE)
27 27
28#endif /* fmthe_h */ 28#endif /* fmthe_h */
29 29
diff --git a/mps/code/mpm.c b/mps/code/mpm.c
index 8af2ffff7ee..4f9af3f888c 100644
--- a/mps/code/mpm.c
+++ b/mps/code/mpm.c
@@ -34,7 +34,7 @@ unsigned CheckLevel = CHECKLEVEL_INITIAL;
34Bool MPMCheck(void) 34Bool MPMCheck(void)
35{ 35{
36 CHECKL(sizeof(Word) * CHAR_BIT == MPS_WORD_WIDTH); 36 CHECKL(sizeof(Word) * CHAR_BIT == MPS_WORD_WIDTH);
37 CHECKL(1uL << MPS_WORD_SHIFT == MPS_WORD_WIDTH); 37 CHECKL((Word)1 << MPS_WORD_SHIFT == MPS_WORD_WIDTH);
38 CHECKL(AlignCheck(MPS_PF_ALIGN)); 38 CHECKL(AlignCheck(MPS_PF_ALIGN));
39 /* Check that trace ids will fit in the TraceId type. */ 39 /* Check that trace ids will fit in the TraceId type. */
40 CHECKL(TraceLIMIT <= UINT_MAX); 40 CHECKL(TraceLIMIT <= UINT_MAX);
@@ -52,10 +52,10 @@ Bool MPMCheck(void)
52 CHECKL(!SizeIsAligned(31051, 1024)); 52 CHECKL(!SizeIsAligned(31051, 1024));
53 CHECKL(!SizeIsP2(0)); 53 CHECKL(!SizeIsP2(0));
54 CHECKL(SizeIsP2(128)); 54 CHECKL(SizeIsP2(128));
55 CHECKL(SizeLog2(1L) == 0); 55 CHECKL(SizeLog2((Size)1) == 0);
56 CHECKL(SizeLog2(256L) == 8); 56 CHECKL(SizeLog2((Size)256) == 8);
57 CHECKL(SizeLog2(65536L) == 16); 57 CHECKL(SizeLog2((Size)65536) == 16);
58 CHECKL(SizeLog2(131072L) == 17); 58 CHECKL(SizeLog2((Size)131072) == 17);
59 59
60 /* .check.writef: We check that various types will fit in a Word; */ 60 /* .check.writef: We check that various types will fit in a Word; */
61 /* See .writef.check. Don't need to check WriteFS or WriteFF as they */ 61 /* See .writef.check. Don't need to check WriteFS or WriteFF as they */
diff --git a/mps/code/mps.h b/mps/code/mps.h
index af718b7ce5d..fd2c850ccf0 100644
--- a/mps/code/mps.h
+++ b/mps/code/mps.h
@@ -631,7 +631,7 @@ extern mps_res_t mps_fix(mps_ss_t, mps_addr_t *);
631 { 631 {
632 632
633#define MPS_FIX1(ss, ref) \ 633#define MPS_FIX1(ss, ref) \
634 (_mps_wt = 1uL << ((mps_word_t)(ref) >> _mps_w0 \ 634 (_mps_wt = (mps_word_t)1 << ((mps_word_t)(ref) >> _mps_w0 \
635 & (sizeof(mps_word_t) * CHAR_BIT - 1)), \ 635 & (sizeof(mps_word_t) * CHAR_BIT - 1)), \
636 _mps_w2 |= _mps_wt, \ 636 _mps_w2 |= _mps_wt, \
637 _mps_w1 & _mps_wt) 637 _mps_w1 & _mps_wt)
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c
index a2e429da7cb..3614590c8a8 100644
--- a/mps/code/poolamc.c
+++ b/mps/code/poolamc.c
@@ -536,7 +536,7 @@ static Bool amcNailboardCheck(amcNailboard board)
536 /* We know that shift corresponds to pool->align. */ 536 /* We know that shift corresponds to pool->align. */
537 CHECKL(BoolCheck(board->newMarks)); 537 CHECKL(BoolCheck(board->newMarks));
538 CHECKL(board->distinctNails <= board->nails); 538 CHECKL(board->distinctNails <= board->nails);
539 CHECKL(1uL << board->markShift 539 CHECKL((Align)1 << board->markShift
540 == PoolAlignment(amcGenPool(board->gen))); 540 == PoolAlignment(amcGenPool(board->gen)));
541 /* weak check for BTs @@@@ */ 541 /* weak check for BTs @@@@ */
542 CHECKL(board->mark != NULL); 542 CHECKL(board->mark != NULL);
diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c
index 38673219495..bb010854a6a 100644
--- a/mps/code/poolawl.c
+++ b/mps/code/poolawl.c
@@ -1242,7 +1242,7 @@ static Bool AWLCheck(AWL awl)
1242 CHECKS(AWL, awl); 1242 CHECKS(AWL, awl);
1243 CHECKD(Pool, &awl->poolStruct); 1243 CHECKD(Pool, &awl->poolStruct);
1244 CHECKL(awl->poolStruct.class == AWLPoolClassGet()); 1244 CHECKL(awl->poolStruct.class == AWLPoolClassGet());
1245 CHECKL(1uL << awl->alignShift == awl->poolStruct.alignment); 1245 CHECKL((Align)1 << awl->alignShift == awl->poolStruct.alignment);
1246 CHECKD(Chain, awl->chain); 1246 CHECKD(Chain, awl->chain);
1247 /* 30 is just a sanity check really, not a constraint. */ 1247 /* 30 is just a sanity check really, not a constraint. */
1248 CHECKL(0 <= awl->gen); 1248 CHECKL(0 <= awl->gen);
diff --git a/mps/code/poollo.c b/mps/code/poollo.c
index c6f22a595cf..49346f4cb56 100644
--- a/mps/code/poollo.c
+++ b/mps/code/poollo.c
@@ -817,7 +817,7 @@ static Bool LOCheck(LO lo)
817 CHECKD(Pool, &lo->poolStruct); 817 CHECKD(Pool, &lo->poolStruct);
818 CHECKL(lo->poolStruct.class == EnsureLOPoolClass()); 818 CHECKL(lo->poolStruct.class == EnsureLOPoolClass());
819 CHECKL(ShiftCheck(lo->alignShift)); 819 CHECKL(ShiftCheck(lo->alignShift));
820 CHECKL(1uL << lo->alignShift == PoolAlignment(&lo->poolStruct)); 820 CHECKL((Align)1 << lo->alignShift == PoolAlignment(&lo->poolStruct));
821 CHECKD(Chain, lo->chain); 821 CHECKD(Chain, lo->chain);
822 CHECKD(PoolGen, &lo->pgen); 822 CHECKD(PoolGen, &lo->pgen);
823 return TRUE; 823 return TRUE;
diff --git a/mps/code/ref.c b/mps/code/ref.c
index a52fd60064b..fd11743cb1e 100644
--- a/mps/code/ref.c
+++ b/mps/code/ref.c
@@ -27,7 +27,7 @@ Bool RankCheck(Rank rank)
27 27
28Bool RankSetCheck(RankSet rankSet) 28Bool RankSetCheck(RankSet rankSet)
29{ 29{
30 CHECKL(rankSet < (1uL << RankLIMIT)); 30 CHECKL(rankSet < ((ULongest)1 << RankLIMIT));
31 UNUSED(rankSet); /* <code/mpm.c#check.unused> */ 31 UNUSED(rankSet); /* <code/mpm.c#check.unused> */
32 return TRUE; 32 return TRUE;
33} 33}
diff --git a/mps/code/steptest.c b/mps/code/steptest.c
index 821a0d5c95a..16477d10f8e 100644
--- a/mps/code/steptest.c
+++ b/mps/code/steptest.c
@@ -19,7 +19,7 @@
19#include <stdlib.h> 19#include <stdlib.h>
20#include <string.h> 20#include <string.h>
21 21
22#define testArenaSIZE ((size_t)(64l << 20)) 22#define testArenaSIZE ((size_t)((size_t)64 << 20))
23#define avLEN 3 23#define avLEN 3
24#define exactRootsCOUNT 200 24#define exactRootsCOUNT 200
25#define ambigRootsCOUNT 50 25#define ambigRootsCOUNT 50
diff --git a/mps/code/table.c b/mps/code/table.c
index e1db04202b3..772e45d9d30 100644
--- a/mps/code/table.c
+++ b/mps/code/table.c
@@ -157,7 +157,7 @@ extern Res TableCreate(Table *tableReturn, size_t length)
157 if(table == NULL) goto failMallocTable; 157 if(table == NULL) goto failMallocTable;
158 if (length < 2) length = 2; 158 if (length < 2) length = 2;
159 /* Table size is length rounded up to the next power of 2. */ 159 /* Table size is length rounded up to the next power of 2. */
160 table->length = 1 << (sizeFloorLog2(length-1) + 1); 160 table->length = (size_t)1 << (sizeFloorLog2(length-1) + 1);
161 table->count = 0; 161 table->count = 0;
162 table->limit = (size_t)(.5 * length); 162 table->limit = (size_t)(.5 * length);
163 table->array = malloc(sizeof(TableEntryStruct) * length); 163 table->array = malloc(sizeof(TableEntryStruct) * length);
diff --git a/mps/code/trace.c b/mps/code/trace.c
index 6e8c8b262b0..0a7b73efa70 100644
--- a/mps/code/trace.c
+++ b/mps/code/trace.c
@@ -123,7 +123,7 @@ Bool TraceIdCheck(TraceId ti)
123 123
124Bool TraceSetCheck(TraceSet ts) 124Bool TraceSetCheck(TraceSet ts)
125{ 125{
126 CHECKL(ts < (1uL << TraceLIMIT)); 126 CHECKL(ts < ((ULongest)1 << TraceLIMIT));
127 UNUSED(ts); /* <code/mpm.c#check.unused> */ 127 UNUSED(ts); /* <code/mpm.c#check.unused> */
128 return TRUE; 128 return TRUE;
129} 129}
diff --git a/mps/code/walkt0.c b/mps/code/walkt0.c
index 44b7a38d1f4..1764b3f9f10 100644
--- a/mps/code/walkt0.c
+++ b/mps/code/walkt0.c
@@ -20,7 +20,7 @@
20#include <stdlib.h> 20#include <stdlib.h>
21#include <string.h> 21#include <string.h>
22 22
23#define testArenaSIZE ((size_t)(64l << 20)) 23#define testArenaSIZE ((size_t)((size_t)64 << 20))
24#define avLEN 3 24#define avLEN 3
25#define exactRootsCOUNT 200 25#define exactRootsCOUNT 200
26#define objCOUNT 20000 26#define objCOUNT 20000
diff --git a/mps/code/zcoll.c b/mps/code/zcoll.c
index 546e6b50def..21b1ffbd07d 100644
--- a/mps/code/zcoll.c
+++ b/mps/code/zcoll.c
@@ -97,7 +97,7 @@ static ulongest_t cols(size_t bytes)
97 double M; /* Mebibytes */ 97 double M; /* Mebibytes */
98 ulongest_t cM; /* hundredths of a Mebibyte */ 98 ulongest_t cM; /* hundredths of a Mebibyte */
99 99
100 M = (double)bytes / (1UL<<20); 100 M = (double)bytes / ((ulongest_t)1<<20);
101 cM = (ulongest_t)(M * 100.0 + 0.5); /* round to nearest */ 101 cM = (ulongest_t)(M * 100.0 + 0.5); /* round to nearest */
102 return cM; 102 return cM;
103} 103}
@@ -139,9 +139,9 @@ static void showStatsAscii(size_t notcon, size_t con, size_t live, size_t alimit
139 * Output: (Megabytes) 0m209 139 * Output: (Megabytes) 0m209
140 */ 140 */
141#if 0 141#if 0
142#define bPerM (1UL << 20) /* Mebibytes */ 142#define bPerM ((size_t)1 << 20) /* Mebibytes */
143#else 143#else
144#define bPerM (1000000UL) /* Megabytes */ 144#define bPerM ((size_t)1000000) /* Megabytes */
145#endif 145#endif
146static void print_M(size_t bytes) 146static void print_M(size_t bytes)
147{ 147{