softfloat: use GCC builtins to count the leading zeros
[qemu.git] / hw / pixel_ops.h
blobd390adfd1b3ef401a3fcbce8b5e86bd14b26584e
1 static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g,
2 unsigned int b)
4 return ((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6);
7 static inline unsigned int rgb_to_pixel15(unsigned int r, unsigned int g,
8 unsigned int b)
10 return ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
13 static inline unsigned int rgb_to_pixel15bgr(unsigned int r, unsigned int g,
14 unsigned int b)
16 return ((b >> 3) << 10) | ((g >> 3) << 5) | (r >> 3);
19 static inline unsigned int rgb_to_pixel16(unsigned int r, unsigned int g,
20 unsigned int b)
22 return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
25 static inline unsigned int rgb_to_pixel16bgr(unsigned int r, unsigned int g,
26 unsigned int b)
28 return ((b >> 3) << 11) | ((g >> 2) << 5) | (r >> 3);
31 static inline unsigned int rgb_to_pixel24(unsigned int r, unsigned int g,
32 unsigned int b)
34 return (r << 16) | (g << 8) | b;
37 static inline unsigned int rgb_to_pixel24bgr(unsigned int r, unsigned int g,
38 unsigned int b)
40 return (b << 16) | (g << 8) | r;
43 static inline unsigned int rgb_to_pixel32(unsigned int r, unsigned int g,
44 unsigned int b)
46 return (r << 16) | (g << 8) | b;
49 static inline unsigned int rgb_to_pixel32bgr(unsigned int r, unsigned int g,
50 unsigned int b)
52 return (b << 16) | (g << 8) | r;