#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 ;
}
运行结果: