Charles Greathouse on Mon, 30 Jan 2017 18:41:24 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Number of 32-bit words in an integer


Is there a nicer way to compute the number of 32-bit words in a given integer than what I'm doing now?

#ifdef LONG_IS_64BIT
    long words = (lgefint(n) - 2) << 1;
    if ((ulong)*int_MSW(n) <= 0xFFFFFFFF)
        words--;
#else
    long words = lgefint(n) - 2;
#endif

Charles Greathouse
Case Western Reserve University