G
Gernot Frisch
Hi,
the program below workes w/o problems on a GP2X and on the PC, but my
PocketPC (using GCC 3.3.3) crashes.
Very dissapointing, since I expect some speed boost from it.
Thnak you for your help.
int dx=..; // number of pixels width to draw
// one pixel is one unsigned short
// Get some pointer to the screen to draw a rect
unsigned short* pScreen = getColorBuffer(x,y);
int num_q = dx>>2; // number of 4 pixel pairs
int num_r = (dx & 0x00000003); // remaining pixels -> loop unrolling
// prepair a 2 pixel pair "long"
unsigned long colcol = col | ((unsigned long)col << 16);
// get a long pointer to that screen (draw 2 "shorts" at once)
unsigned long* pScLong = (unsigned long*)pScreen;
... loop for each line
for(register int rx=0; rx<num_q; ++rx)
{
#ifdef THIS_CRASHES
*pScLong++ = colcol;
*pScLong++ = colcol;
pScreen+=4;
#else
*pScreen++ = col;
*pScreen++ = col;
*pScreen++ = col;
*pScreen++ = col;
#endif
}
... remaining pixels and next lines...
the program below workes w/o problems on a GP2X and on the PC, but my
PocketPC (using GCC 3.3.3) crashes.
Very dissapointing, since I expect some speed boost from it.
Thnak you for your help.
int dx=..; // number of pixels width to draw
// one pixel is one unsigned short
// Get some pointer to the screen to draw a rect
unsigned short* pScreen = getColorBuffer(x,y);
int num_q = dx>>2; // number of 4 pixel pairs
int num_r = (dx & 0x00000003); // remaining pixels -> loop unrolling
// prepair a 2 pixel pair "long"
unsigned long colcol = col | ((unsigned long)col << 16);
// get a long pointer to that screen (draw 2 "shorts" at once)
unsigned long* pScLong = (unsigned long*)pScreen;
... loop for each line
for(register int rx=0; rx<num_q; ++rx)
{
#ifdef THIS_CRASHES
*pScLong++ = colcol;
*pScLong++ = colcol;
pScreen+=4;
#else
*pScreen++ = col;
*pScreen++ = col;
*pScreen++ = col;
*pScreen++ = col;
#endif
}
... remaining pixels and next lines...