I'm using the follwing macro function:
#define MK_RGB5651(R,G,B,R1,B1,G1) \ (__int32) (
((MAX(0,MIN(255, R1)) << 0x18) & 0xf8000000) | \
((MAX(0,MIN(255, G1)) << 0x13) & 0x07e00000) | \
((MAX(0,MIN(255, B1)) << 0xd) & 0x001f0000) | \
((MAX(0,MIN(255, R)) << 8) & 0x0000f800) | \
((MAX(0,MIN(255, G)) << 3) & 0x000007e0) | \
((MAX(0,MIN(255, B)) >> 3) & 0x0000001f) )
R,G,B,R1,B1,G1 are int type.
I dunno why the 2 least significant bit of the 32-bit output are always 1s
(no matter what my input is).
Also, I could not ust decimal 24 instead of hex 0x18 (the same holds for
0x13 and 0xd).
Could someone give me pointers to these two problems?