代码如下: int color = 4; LOGE("color:%x\n", color); color |= (color << 8); //color |= (color << 16); LOGE("color:%x\n", color); color |= (color << 16); LOGE("color:%x\n", color);
log如下:
2020-04-15 11:39:07.528 22135-22166/org.libsdl.app E/C-test: color:4
2020-04-15 11:39:07.528 22135-22166/org.libsdl.app E/C-test: color:404 =》左移8位并或操作
2020-04-15 11:39:07.528 22135-22166/org.libsdl.app E/C-test: color:4040404 =》 左移16位并或操作