void* AlignedMemory::allocate(size_t size, size_t alignment)
{
assert(0 < alignment && alignment <= 128 && Bitwise::isPO2(alignment));
unsigned char* p = new unsigned char[size + alignment];
size_t offset = alignment - (size_t(p) & (alignment-1)); //这是什么意思?
unsigned char* result = p + offset;
result[-1] = (unsigned char)offset; //这是什么意思?
return result;
}
莫回无
慕运维8079593