This commit is contained in:
Igor Pavlov
2003-12-11 00:00:00 +00:00
committed by Kornel Lesiński
commit 8c1b5c7b7e
982 changed files with 118799 additions and 0 deletions
+22
View File
@@ -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;
}