> -----Original Message-----
> From: Martin Sebor [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, October 10, 2006 9:30 PM
> To: [email protected]
> Subject: Re: [PATCH] bitset.cc (STDCXX-297)
> 
> >   5 is log2(sizeof (*bits) * CHAR_BIT)
> >   2 is log2(sizeof (*bits))
> 
[...]
> I would just hardcode it based on the size of the type. 
> Something simple like this (the same code is at the top of 
> bitset.cpp) will
> work:
> 
>    enum {
>    #if 4 == _RWSTD_ULONG_SIZE
>        log2_long_size = 2,
>        log2_long_bits = 5

  "log2_long_bits = 5" is correct only for CHAR_BIT == 8

  More correct to define log2_long_bits = log2_long_size +
log2_char_bits, but
how we can define log2_char_bits?

enum {
#if 8 == _RWSTD_CHAR_BIT
    log2_char_bits = 3
#else if 16 == _RWSTD_CHAR_BIT
    log2_char_bits = 4
#else if 32 == _RWSTD_CHAR_BIT
    log2_char_bits = 5
#else // assume 64 == _RWSTD_CHAR_BIT
    log2_char_bits = 6
#endif
};

  That will be enough?

  Maybe better to extend etc/src/LIMITS.cpp to calculate and define
macro _RWSTD_LOG2_CHAR_BIT?

Farid.

Reply via email to