for(int x = 0; x < 240; x++) { u32 color = *ta; if(color < 0x80000000) { int r = (color & 0x1F); int g = ((color >> 5) & 0x1F); int b = ((color >> 10) & 0x1F); u32 color2 = (*tb++); int r0 = (color2 & 0x1F); int g0 = ((color2 >> 5) & 0x1F); int b0 = ((color2 >> 10) & 0x1F);  r = ((r * ca) >> 4) + ((r0 * cb) >> 4); g = ((g * ca) >> 4) + ((g0 * cb) >> 4); b = ((b * ca) >> 4) + ((b0 * cb) >> 4);  if(r > 31) r = 31; if(g > 31) g = 31; if(b > 31) b = 31;  *ta++ = (color & 0xFFFF0000) | (b << 10) | (g << 5) | r; } else { ta++; tb++; }
if(color < 0x80000000) { int r = (color & 0x1F); int g = ((color >> 5) & 0x1F); int b = ((color >> 10) & 0x1F); int r0 = (color2 & 0x1F); int g0 = ((color2 >> 5) & 0x1F); int b0 = ((color2 >> 10) & 0x1F);  r = ((r * ca) >> 4) + ((r0 * cb) >> 4); g = ((g * ca) >> 4) + ((g0 * cb) >> 4); b = ((b * ca) >> 4) + ((b0 * cb) >> 4);  if(r > 31) r = 31; if(g > 31) g = 31; if(b > 31) b = 31;  return (color & 0xFFFF0000) | (b << 10) | (g << 5) | r;
inline void gfxAlphaBlend(u32 *ta, u32 *tb, int ca, int cb){  for(int x = 0; x < 240; x++) {    u32 color = *ta;    if(color < 0x80000000) {      int r = (color & 0x1F);      int g = ((color >> 5) & 0x1F);      int b = ((color >> 10) & 0x1F);      u32 color2 = (*tb++);      int r0 = (color2 & 0x1F);      int g0 = ((color2 >> 5) & 0x1F);      int b0 = ((color2 >> 10) & 0x1F);            r = ((r * ca) >> 4) + ((r0 * cb) >> 4);      g = ((g * ca) >> 4) + ((g0 * cb) >> 4);      b = ((b * ca) >> 4) + ((b0 * cb) >> 4);            if(r > 31)        r = 31;      if(g > 31)        g = 31;      if(b > 31)        b = 31;            *ta++ = (color & 0xFFFF0000) | (b << 10) | (g << 5) | r;    } else {      ta++;      tb++;    }  }}