开发者

Using _BitScanReverse64

开发者 https://www.devze.com 2023-02-27 03:08 出处:网络
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:

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

精彩评论

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