#include <stdio.h>
#define BYTE_MASK 0xff
int main(int argc, char **argv)
{
unsigned long color = 0x002a162f;
unsigned char blue,green,red;
red = color & BYTE_MASK;
green = (color >> 8) & BYTE_MASK;
blue = (color >> 16) & BYTE_MASK;
printf("color = 0x%x\nred = 0x%x, green = 0x%x, blue = 0x%x\n",color,red,green,blue);
return 0;
}
位操作移位的一个简单应用
最新推荐文章于 2024-08-22 09:27:27 发布