7 * Compose two values, using a bitmask as decision value
8 * This is equivalent to (a & mask) | (b & ~mask)
11 static inline unsigned long
12 comp(unsigned long a
, unsigned long b
, unsigned long mask
)
14 return ((a
^ b
) & mask
) ^ b
;
18 * Create a pattern with the given pixel's color
21 #if BITS_PER_LONG == 64
22 static inline unsigned long
23 pixel_to_pat( u32 bpp
, u32 pixel
)
27 return 0xfffffffffffffffful
*pixel
;
29 return 0x5555555555555555ul
*pixel
;
31 return 0x1111111111111111ul
*pixel
;
33 return 0x0101010101010101ul
*pixel
;
35 return 0x0001001001001001ul
*pixel
;
37 return 0x0001000100010001ul
*pixel
;
39 return 0x0000000001000001ul
*pixel
;
41 return 0x0000000100000001ul
*pixel
;
43 panic("pixel_to_pat(): unsupported pixelformat\n");
47 static inline unsigned long
48 pixel_to_pat( u32 bpp
, u32 pixel
)
52 return 0xfffffffful
*pixel
;
54 return 0x55555555ul
*pixel
;
56 return 0x11111111ul
*pixel
;
58 return 0x01010101ul
*pixel
;
60 return 0x00001001ul
*pixel
;
62 return 0x00010001ul
*pixel
;
64 return 0x00000001ul
*pixel
;
66 return 0x00000001ul
*pixel
;
68 panic("pixel_to_pat(): unsupported pixelformat\n");
72 #endif /* FB_DRAW_H */