[*] aubytebuffer move: carry user alignment

This commit is contained in:
Reece Wilson 2024-01-17 19:04:27 +00:00
parent 9ac6be62f4
commit d4eab8e477

View File

@ -97,6 +97,7 @@ namespace Aurora::Memory
this->scaleSize = buffer.scaleSize;
this->flagReadError = buffer.flagReadError;
this->flagWriteError = buffer.flagWriteError;
this->alignment = buffer.alignment;
buffer.base = {};
buffer.length = {};
buffer.allocSize = {};
@ -106,6 +107,7 @@ namespace Aurora::Memory
buffer.flagExpandable = {};
buffer.flagAlwaysExpandable = {};
buffer.scaleSize = {};
buffer.alignment = {};
}
/**
@ -116,9 +118,16 @@ namespace Aurora::Memory
inline ByteBuffer(const ByteBuffer &buffer, bool preservePointers = true)
{
if (buffer.length)
{
if (buffer.alignment)
{
this->base = ZAlloc<AuUInt8 *>(buffer.length, buffer.alignment);
}
else
{
this->base = ZAlloc<AuUInt8 *>(buffer.length);
}
}
this->scaleSize = buffer.scaleSize;
this->flagCircular = buffer.flagCircular;
this->flagExpandable = buffer.flagExpandable;
@ -216,6 +225,7 @@ namespace Aurora::Memory
}
this->scaleSize = kBufferInitialPower;
this->base = ZAlloc<AuUInt8 *>(length, alignment);
this->alignment = alignment;
if (!this->base)
{
Reset();