pagemap: cast uintptr_t to size_t before bit math

Not strictly necessary, but makes the CHERI compiler happier to see that
we're using a decidedly integral type rather than a possibly tagged
quantity.
This commit is contained in:
Nathaniel Filardo
2019-11-26 18:01:23 +00:00
parent d13d810b66
commit f8115a81b1

View File

@@ -191,7 +191,7 @@ namespace snmalloc
return std::pair(nullptr, 0);
shift -= BITS_PER_INDEX_LEVEL;
ix = (addr >> shift) & ENTRIES_MASK;
ix = (static_cast<size_t>(addr) >> shift) & ENTRIES_MASK;
e = &value->entries[ix];
if constexpr (INDEX_LEVELS == 1)
@@ -211,7 +211,7 @@ namespace snmalloc
return std::pair(nullptr, 0);
shift -= BITS_FOR_LEAF;
ix = (addr >> shift) & LEAF_MASK;
ix = (static_cast<size_t>(addr) >> shift) & LEAF_MASK;
return std::pair(leaf, ix);
}