move bitmap helper functions to common.h; preserve callee-saved registers in vmInvoke()

This commit is contained in:
Joel Dice
2007-10-11 20:52:16 -06:00
parent 201a658941
commit 3e1dbab0f0
4 changed files with 45 additions and 27 deletions

View File

@ -127,6 +127,24 @@ indexOf(unsigned word, unsigned bit)
return (word * BitsPerWord) + bit;
}
inline void
markBit(uintptr_t* map, unsigned i)
{
map[wordOf(i)] |= static_cast<uintptr_t>(1) << bitOf(i);
}
inline void
clearBit(uintptr_t* map, unsigned i)
{
map[wordOf(i)] &= ~(static_cast<uintptr_t>(1) << bitOf(i));
}
inline unsigned
getBit(uintptr_t* map, unsigned i)
{
return map[wordOf(i)] & (static_cast<uintptr_t>(1) << bitOf(i));
}
template <class T>
inline T&
cast(void* p, unsigned offset)