fix integer truncation bug

This commit is contained in:
Joel Dice 2009-10-17 18:35:19 -06:00
parent cec6444911
commit f702795178
2 changed files with 13 additions and 1 deletions

View File

@ -260,6 +260,18 @@ pad(unsigned n)
return pad(n, BytesPerWord);
}
inline uintptr_t
padWord(uintptr_t n, uintptr_t alignment)
{
return (n + (alignment - 1)) & ~(alignment - 1);
}
inline uintptr_t
padWord(uintptr_t n)
{
return padWord(n, BytesPerWord);
}
inline unsigned
ceiling(unsigned n, unsigned d)
{

View File

@ -7694,7 +7694,7 @@ boot(MyThread* t, BootImage* image)
unsigned* callTable = stringTable + image->stringCount;
uintptr_t* heapMap = reinterpret_cast<uintptr_t*>
(pad(reinterpret_cast<uintptr_t>(callTable + (image->callCount * 2))));
(padWord(reinterpret_cast<uintptr_t>(callTable + (image->callCount * 2))));
unsigned heapMapSizeInWords = ceiling
(heapMapSize(image->heapSize), BytesPerWord);
uintptr_t* heap = heapMap + heapMapSizeInWords;