I noticed that when I enabled nearest neighbor filtering, my textures showed up grayscale. I looked at the code I wrote, which appeared fine:
ui8 *pix;
switch(src->format){
case E_RGB:
case E_ANIM_RGB:{
pix = src->data + (src->frameSize * src->currFrame) + 3*(src->width*(_E_mathRoundf(y)) + _E_mathRoundf(x));
return _E_eoiD1(*(pix++))|_E_eoiD2(*(pix++))|_E_eoiD3(*(pix))|_E_eoiD4(0xFF);
}
break;
...
}
The _E_eoiDn macros simply shift the passed value to be the nth byte in the integer.
To me, it would seem that it would increment the pointer upon each evaluation of the variable. Apparently that isn't the case; the rewrite I wrote below showed the colors properly, rather than only using one channel for all three.
ui8 *pix;
si32 result;
switch(src->format){
case E_RGB:
case E_ANIM_RGB:{
pix = src->data + (src->frameSize * src->currFrame) + 3*(src->width*(_E_mathRoundf(y)) + _E_mathRoundf(x));
memcpy(&result,pix,3);
return result|_E_eoiD4(0xFF);
}
break;
...
}
So, I suppose my question is, if I have multiple incrementing operators on the same variable at different parts of a statement, is it evaluated and incremented more than once in sequence as I'd expected, or does it do all of the increments prior to evaluating the entire expression?