Memory access violation after manipulating _m128i pointer.



In my program, i need to manipulate the _m128* POINTER to nevigate through
some memory chunk. Nevigating via POINTER++/-- works absolutely fine; but,
when i try to nevigate this POINTER by more or less than 16 bytes, i get
memory access violation error.

this is how my code looks like:

__m128i *row = (__m128i *)Source; //Source points to an aligned memory
WIDTH_OFFSET = 4; //some non zero number < 16
for(OFFSET = 0; some_condition; OFFSET = WIDTH_OFFSET)
{

row = (__m128i *)((UCHAR*)row - OFFSET) - 1;
*row = _mm_andnot_si128(*row, mmFF);
//mmFF is an initialized _m128i variant

}




here execution is fine in the first entrance of the loop(while OFFSET = 0);
but when i try to increment/decrement the POINTER by (say) 4 bytes, upon next
usage of that POINTER i get a runtime error saying memory access violation.



do help me out with a solution ! thanks.
.



Relevant Pages

  • Re: Access violation before startup in debug mode
    ... Thanks, David. ... the Access Violation error from "Stop if not handled" to "Stop ... returning a null pointer, and then the pointer is used to call ... can anybody suggest why AfxGetThread() might ...
    (microsoft.public.vc.mfc)
  • Re: access violation
    ... > I have a problem with Access Violation error. ... function TForm1.something(psl: Pointer): boolean; ... HTH ...
    (alt.comp.lang.borland-delphi)

Loading