做什么和×0040的标志管这里表示? [英] What do 0x0040 and pipe sign denote here?
问题描述
下面SIMPLE_EX2用×0040是或运算和整个本提供作为地址来SIMPLE_EX1。我的理解是否正确?
的#define SIMPLE_EX1(×0040 | SIMPLE_EX2)
|
不是C.管道标志这是一个逐位或。所以这前pression:
×0040 | SIMPLE_EX2
只是获取 SIMPLE_EX2
的值,并将它的7 个位(右一)为1。
不太可能的,但要注意,如果 SIMPLE_EX2
本身就是一个前pression与具有较低的precedence比运营商|
,整体前pression可能会错误地PTED间$ p $。例如,如果 SIMPLE_EX2
是 A B:C
,那么 SIMPLE_EX1
变成(×0040 |一)b:?ç
这不是我上面写的
Here SIMPLE_EX2 is being ORed with 0x0040 and the whole this providing as an address to SIMPLE_EX1. Is my understanding correct?
#define SIMPLE_EX1 (0x0040 | SIMPLE_EX2)
|
is not a pipe sign in C. It's a bit-wise or. So this expression:
0x0040 | SIMPLE_EX2
Simply gets the value of SIMPLE_EX2
and sets it's 7th bit (from right) to 1.
Unlikely, but note that if SIMPLE_EX2
itself is an expression with an operator that has lower precedence than |
, the overall expression may be interpreted wrongly. For example if SIMPLE_EX2
is a?b:c
, then SIMPLE_EX1
becomes (0x0040|a)?b:c
which is not what I wrote above.
这篇关于做什么和×0040的标志管这里表示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!