0x0f55, /* light red */
0x0f5f, /* light magenta */
0x0ff5, /* light yellow */
- 0x0fff, /* white */
+ 0x0fff /* white */
};
struct pixel_ {
static inline
void pixel_color_(struct pixel_ *pix, DCPU16_WORD color) {
- pix->r = (color & 0x000f) | ((color & 0x000f) << 8);
- pix->g = ((color & 0x00f0) >> 8) | (color & 0x00f0);
- pix->b = ((color & 0x0f00) >> 8) | ((color & 0x0f00) >> 16);
- pix->a = ((color & 0xf000) >> 16) | ((color & 0xf000) >> 24);
+ unsigned char x;
+
+ x = (color >> 0) & 0x000f;
+ pix->r = x | (x << 4);
+
+ x = (color >> 4) & 0x000f;
+ pix->g = x | (x << 4);
+
+ x = (color >> 8) & 0x000f;
+ pix->b = x | (x << 4);
+
+ x = (color >> 12) & 0x000f;
+ pix->a = x | (x << 4);
}
static