【发布时间】:2017-03-02 01:48:02
【问题描述】:
在C语言中,我经常看到if这样的语句:
#define STATUS 0x000A
UINT16 InterruptStatus;
if (InterruptStatus & STATUS)
{
<do something here....>
}
如果我有此声明,在处理时间或任何其他原因上是否会有所不同,这不是首选/替代方式?
#define STATUS 0x000A
UINT16 InterruptStatus;
if (InterruptStatus == STATUS)
{
<do something here....>
}
【问题讨论】:
-
InterruptStatus应该是位域吗?还是应该只包含一个值?
标签: c equality bitwise-and