开发者

Using _BitScanReverse64

How to use

_BitScanReverse64(unsigne开发者_如何学Pythond long * Index,  unsigned __int64 Mask)

in order to find a first position set to 1 in integer?


Try this:

   unsigned __int64 mask = some_value;
   unsigned long index;
   unsigned char isNonzero = _BitScanReverse64(&index, mask);
   if (!isNonzero) {
      // index variable contains index of the first bit set to 1
   }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜