c++ - _mm_store_si128 throws exception -


so i've been tryna learn see optimization on own , i'm not quite getting it, thought simple function zeroes memory easy implement, went on , tried implement myself.

here 0 memory function loops buffer start buffer end , uses _mm_store_si128 0 out.

bool zeromem( byte * _dest, uint _sz ) {     if ( _dest == nullptr )         return false;     __m128i 0 = _mm_setzero_si128( );      ( auto = rcast<__m128i*>( _dest ),           end = rcast<__m128i*>( _dest + _sz );           < end; ++i )     {         _mm_store_si128( i, 0 );     }     return true; } 

exception thrown: access violation (0x00000) though pointer not 0x00000.

the test did allocating 1024 bytes of memory , calling zeromem.

the exception thrown on first iteration.

_mm_store_si128 translates movdqa , requires operands aligned on 16-byte boundary cause exception. iirc, example windows doesn't implement explicit alignment exception, causes access violation. concerning memset implementation might interested in this post comparing different approaches filling memory block bytes.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -