Computing the Width of an Integer Data Type
-------------------------------------------
The most common reason that a program needs to know how many bits
are in an integer type is for using an array of `long int' as a bit
vector. You can access the bit at index N with
vector[N / LONGBITS] & (1 << (N % LONGBITS))
provided you define `LONGBITS' as the number of bits in a `long int'.
There is no operator in the C language that can give you the number
of bits in an integer data type. But you can compute it from the macro
`CHAR_BIT', defined in the header file `limits.h'.
`CHAR_BIT'
This is the number of bits in a `char'--eight, on most systems.
The value has type `int'.
You can compute the number of bits in any data type TYPE like this:
sizeof (TYPE) * CHAR_BIT