Menu

BitCount< ValueType, Value > Struct Template Reference

Calculates the least number of bits needed to represent the given value of the specified type. More...

#include <ByteCount.h>

Public Types

typedef ValueType value_type
 The value type as defined by Boost MPL.
typedef boost::mpl::integral_c_tag tag
 The tag type as defined by Boost MPL.
typedef BitCount type
 The self type as defined by Boost MPL.

Static Public Attributes

static const uint16_t value
 The value as defined by Boost MPL.

Detailed Description

template<typename ValueType, ValueType Value>
struct BitCount< ValueType, Value >

Calculates the least number of bits needed to represent the given value of the specified type.

Template Parameters:
ValueType The type of the value
Value The value to calculate the bit count for

Member Typedef Documentation

template<typename ValueType , ValueType Value>
typedef boost::mpl::integral_c_tag BitCount< ValueType, Value >::tag

The tag type as defined by Boost MPL.

template<typename ValueType , ValueType Value>
typedef BitCount BitCount< ValueType, Value >::type

The self type as defined by Boost MPL.

template<typename ValueType , ValueType Value>
typedef ValueType BitCount< ValueType, Value >::value_type

The value type as defined by Boost MPL.


Field Documentation

template<typename ValueType , ValueType Value>
const uint16_t BitCount< ValueType, Value >::value [static]
Initial value:
 boost::mpl::eval_if_c<(Value != 0),
                                                            boost::mpl::plus<BitCount<ValueType, (Value >> 1)>,
                                                                             boost::mpl::int_<1>
                                                                            >,
                                                            boost::mpl::int_<0>
                                                           >::type::value

The value as defined by Boost MPL.

The value represents the number of bits needed to represent the value given as the second template argument.


The documentation for this struct was generated from the following file: