mirror of
https://github.com/Xevion/easy7zip.git
synced 2026-01-31 14:24:09 -06:00
3.13
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
// AlignedBuffer.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "AlignedBuffer.h"
|
||||
#include "Types.h"
|
||||
|
||||
void *CAlignedBuffer::Allocate(size_t numItems, size_t itemSize, size_t alignValue)
|
||||
{
|
||||
Free();
|
||||
m_Buffer = new unsigned char[numItems * itemSize + alignValue - 1];
|
||||
UINT_PTR p = UINT_PTR(m_Buffer) + (alignValue - 1);
|
||||
p -= (p % alignValue);
|
||||
return (void *)p;
|
||||
}
|
||||
|
||||
void CAlignedBuffer::Free()
|
||||
{
|
||||
if (m_Buffer != 0)
|
||||
delete []m_Buffer;
|
||||
m_Buffer = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user