【发布时间】:2015-11-10 08:56:45
【问题描述】:
我想了解 C 运算符 |= 做了什么:
// Initialize the green led
// Enable the clock for PORT D. See Page 216 of the Datasheet
SIM_SCGC5 |= (1U<<12);
// Enable the mux as GPIO. See Page 193 of the Datasheet
PORTD_PCR5 = 0x100;
我也不明白0x100 是什么意思。
【问题讨论】:
-
a |= b;isa = a | b;likea += b;isa = a + b;etc. -
0x100 是 256 的十六进制表示;
-
哇,我不敢相信以前没有人在 SO 上问过这个问题。我是基于您在搜索时没有找到它的事实。您进行过搜索,不是吗? :-)
-
我做了@paxdiablo。我猜谷歌在搜索运算符方面并没有那么好。无论如何谢谢;-)
-
"c operator" 会给你带来无数的点击率。
标签: c operator-keyword