Based on what you've posted, the macro seems to be intended to answer a question like, "How many char
s does it take to hold 18 bits?" That question could be answered with this line of code
int count = howmany( 18, CHAR_BIT );
which will set count
to 3.
The macro works by first checking if y
divides evenly into x
. If so, it returns x/y
, otherwise it divides x
by y
and rounds up.