On April 9, 2003 01:22 am, Dan Kegel wrote:
How 'bout
BYTE SwapROP3_SrcDst(BYTE bRop3) { /* swap 1,2 bit and 5,6 bit */ BYTE bits44 = (bRop3 & 0x44) >> 1; BYTE bits22 = (bRop3 & 0x22) << 1; return (bRop3 & 0x99) | bits22 | bits44; }
Nice! At which point we might as well inline it all:
inline BYTE SwapROP3_SrcDst(BYTE bRop3) { return (bRop3 & 0x99) | ((bRop3 & 0x22) << 1) | ((bRop3 & 0x44) >> 1); }
:)