我在一次采访中得到了这个问题来描述评论中的输出.
unsigned int d2(unsigned int a) { __int64 q = (__int64)a * 0x0AAAAAAAB; // (2^33+1) / 3 return (unsigned int)(q >> 33); }
我已经在Stackoverflow中检查了与除以3相关的其他问题,但没有一个看起来如此快速和小.任何人都可以帮我解释函数如何给出评论中写的输出?