34#include "DGtal/base/Common.h"
35#include "DGtal/base/Bits.h"
52 return ( n & 1 ) ? i + 1 : 0;
59 unsigned int nbok = 0;
73 for (
unsigned int i = 0; i < 100; ++i )
76 for (
unsigned int b = 0; b < 16; ++b )
82 std::cerr <<
"(" << nbok <<
"/" << nb <<
")" <<
" tests." << std::endl;
87 for (
unsigned int i = 0; i < 100000; ++i )
90 for (
unsigned int b = 0; b < 32; ++b )
93 trace.
info() <<
"- checksum = " << val << std::endl;
96 trace.
beginBlock (
"Testing speed of look-up table version of indexInSetBits" );
98 unsigned int val2 = 0;
99 for (
unsigned int i = 0; i < 100000; ++i )
102 for (
unsigned int b = 0; b < 32; ++b )
105 trace.
info() <<
"- checksum = " << val2 << std::endl;
107 ++nb; nbok += val == val2 ? 1 : 0;
108 return ( nb == nbok ) ? 0 : 1;
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::uint32_t uint32_t
unsigned 32-bit integer.
boost::uint16_t uint16_t
unsigned 16-bit integer.
boost::uint8_t uint8_t
unsigned 8-bit integer.
boost::uint64_t uint64_t
unsigned 64-bit integer.
static unsigned int indexInSetBits(DGtal::uint8_t n, unsigned int b)
static unsigned int nbSetBits(T val)