Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15316979
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2010-08-31 16:12:30

#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]
阅读(2194) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-09-02 08:16:00

Download More than 1000 free IT eBooks: http://free-ebooks.appspot.com