【发布时间】:2014-04-22 04:32:55
【问题描述】:
假设我有类似的东西:
#define SIZE 32
/* ... */
unsigned x;
/* ... */
x %= SIZE;
大多数 C/C++ 编译器(如 GCC)通常会将 x % 32 缩减为 x & 31 吗?
【问题讨论】:
-
@JonathonReinhart 哎呀,我的意思是
x % 32和x & 31。
标签: gcc constants compiler-optimization modulo compile-time-constant