[英]Get 30th bit of the lParam param in WM_KEYDOWN message
I would just use lParam & 0x40000000
.我只会使用
lParam & 0x40000000
。 If that's non-zero, then b30
was set (I consider that the thirty first bit of the thirty two, by the way).如果那不是零,则设置了
b30
(顺便说一下,我认为是 32 的第30 位)。 And there's more likelihood that it will be a {logical-and, compare}
operation rather than {shift, logical-and, compare}
.而且它更有可能是
{logical-and, compare}
操作而不是{shift, logical-and, compare}
。
Mind you, there's a good chance that a decent compiler would generate the more efficient code anyway even if you used (lParam >> 30) & 1
but why take the risk?请注意,即使您使用
(lParam >> 30) & 1
,一个体面的编译器也很有可能生成更高效的代码,但为什么要冒险呢?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.