firewire: remove bogus check in fw_core_handle_request
[linux-2.6] / drivers / video / fb_draw.h
1 #ifndef _FB_DRAW_H
2 #define _FB_DRAW_H
3
4 #include <asm/types.h>
5
6     /*
7      *  Compose two values, using a bitmask as decision value
8      *  This is equivalent to (a & mask) | (b & ~mask)
9      */
10
11 static inline unsigned long
12 comp(unsigned long a, unsigned long b, unsigned long mask)
13 {
14     return ((a ^ b) & mask) ^ b;
15 }
16
17     /*
18      *  Create a pattern with the given pixel's color
19      */
20
21 #if BITS_PER_LONG == 64
22 static inline unsigned long
23 pixel_to_pat( u32 bpp, u32 pixel)
24 {
25         switch (bpp) {
26         case 1:
27                 return 0xfffffffffffffffful*pixel;
28         case 2:
29                 return 0x5555555555555555ul*pixel;
30         case 4:
31                 return 0x1111111111111111ul*pixel;
32         case 8:
33                 return 0x0101010101010101ul*pixel;
34         case 12:
35                 return 0x0001001001001001ul*pixel;
36         case 16:
37                 return 0x0001000100010001ul*pixel;
38         case 24:
39                 return 0x0000000001000001ul*pixel;
40         case 32:
41                 return 0x0000000100000001ul*pixel;
42         default:
43                 panic("pixel_to_pat(): unsupported pixelformat\n");
44     }
45 }
46 #else
47 static inline unsigned long
48 pixel_to_pat( u32 bpp, u32 pixel)
49 {
50         switch (bpp) {
51         case 1:
52                 return 0xfffffffful*pixel;
53         case 2:
54                 return 0x55555555ul*pixel;
55         case 4:
56                 return 0x11111111ul*pixel;
57         case 8:
58                 return 0x01010101ul*pixel;
59         case 12:
60                 return 0x00001001ul*pixel;
61         case 16:
62                 return 0x00010001ul*pixel;
63         case 24:
64                 return 0x00000001ul*pixel;
65         case 32:
66                 return 0x00000001ul*pixel;
67         default:
68                 panic("pixel_to_pat(): unsupported pixelformat\n");
69     }
70 }
71 #endif
72 #endif /* FB_DRAW_H */