未验证 提交 004f415c 编写于 作者: S Steven G. Johnson 提交者: GitHub

suppress MS compiler complaint about negating unsigned (closes #330)

上级 41967f19
......@@ -93,7 +93,12 @@ static unsigned rightzero32(uint32_t n)
const uint32_t a = 0x05f66a47; /* magic number, found by brute force */
static const unsigned decode[32] = { 0, 1, 2, 26, 23, 3, 15, 27, 24, 21, 19, 4, 12, 16, 28, 6, 31, 25, 22, 14, 20, 18, 11, 5, 30, 13, 17, 10, 29, 9, 8, 7 };
n = ~n; /* change to rightmost-one problem */
n = a * (n & (-n)); /* store in n to make sure mult. is 32 bits */
#ifdef _MSC_VER
#pragma warning(suppress:4146)
n = a * (n & (-n)); /* same as below, but suppress spurious warning/error with MS compiler about negating unsigned int */
#else
n = a * (n & (-n)); /* store in n to make sure mult. is 32 bits */
#endif
return decode[n >> 27];
#endif
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册