文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>快速遍历变量中所有置1位

快速遍历变量中所有置1位

时间:2010-08-31  来源:gliethttp

#include <stdio.h>

int main(int argc, char *argv[])
{
    int mask = 0x8039;
    while (mask) {
        int i = 31 - __builtin_clz(mask);
        mask &= ~(1<<i);
        printf("[%d]\n", i);
    }
    return 0;
}

lutherge@wiki-server:~/tmp$ ./a.out
[15]
[5]
[4]
[3]
[0]
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载