RejectedSoftware Forums

Sign up

extractUnalignedPointer ?

Hi

What mission vibe.utils.extractUnalignedPointer has?

Best Regards,
Ilya

Re: extractUnalignedPointer ?

Am 21.08.2015 um 18:30 schrieb Ilya Yaroshenko:

Hi

What mission vibe.utils.extractUnalignedPointer has?

Best Regards,
Ilya

The Allocator interface defines an alignment of 32 bytes. However, the
GC at least used to return memory blocks that weren't aligned like that.
The solution here was to define a function adjustPointerAlignment that
bumps the base pointer to the next multiple of 32 bytes and writes the
difference between that and the original pointer to the byte that
precedes that address. extractUnalignedPointer reverts that process by
reading that byte and substracting that value from the aligned base pointer.