> -----Original Message----- > From: Martin Sebor [mailto:[EMAIL PROTECTED] > Sent: Monday, October 09, 2006 10:55 PM > To: [email protected] > Subject: Re: [PATCH] bitset.cc (STDCXX-297) > > > the bitset). Also, I think the code could be simplified as > > follows: > > > > nbytes = (((maxbits | (sizeof *bits * CHAR_BIT - 1)) >> 5) > > + (0 != (maxbits & (sizeof *bits * CHAR_BIT - 1)))) << 2; > > With the magic 5 and 2 replaced by expressions parametrized > on sizeof *bits, of course. How log2 can be calculated at compile time?
5 is log2(sizeof (*bits) * CHAR_BIT) 2 is log2(sizeof (*bits)) Farid.
