Commit 2311e25a authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline

MemUtils: fix buffer end calc. in SSE2-based code forcing mem. alloc

* Add _mm_empty() add the end of SSE2 block for completeness
parent 5d78adac
......@@ -122,11 +122,12 @@ MemBuffer::MemBuffer(int size)
__m128i zero = _mm_setzero_si128();
for(long i = 0;i < size;i += page_size,ptr+=page_size)
{
if(size_t(size - page_size) > sizeof(__m128i))
if(size_t(size - i) >= sizeof(__m128i))
_mm_store_si128((__m128i*)ptr,zero);
else
*ptr = 0;
}
_mm_empty();
}
else
{
......@@ -150,10 +151,11 @@ MemBuffer::MemBuffer(const MemBuffer& buffer)
MemBuffer::~MemBuffer()
{
if (!m_size)
throw LIMA_COM_EXC(Error, "Deleting empty buffer");
release();
}
void MemBuffer::alloc(int size)
{
if (m_size == size)
......@@ -183,7 +185,7 @@ void MemBuffer::copy(const MemBuffer& buffer)
void MemBuffer::release()
{
if (!m_size)
if (!m_size)
return;
#ifdef __unix
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment