mirror of
https://github.com/corda/corda.git
synced 2025-06-18 23:28:21 +00:00
move bitmap helper functions to common.h; preserve callee-saved registers in vmInvoke()
This commit is contained in:
18
src/common.h
18
src/common.h
@ -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)
|
||||
|
Reference in New Issue
Block a user