#include <stdio.h>
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
//求一个数x是几个long的长度
#define BITS_TO_LONGS(x) (((x) + BITS_PER_LONG - 1) / BITS_PER_LONG)
    
int main(void)
{
int i = 40 ;
int j = 1000 ;
printf("%d\n",BITS_TO_LONGS(i));
printf("%d\n",BITS_TO_LONGS(j));
return 0 ;

}

执行结果:


posted on 2017-06-29 16:10  yutingliuyl  阅读(148)  评论(0编辑  收藏  举报