Added findLSB test

This commit is contained in:
Christophe Riccio 2012-09-16 23:26:25 +02:00
parent 56738ee5cb
commit c7812d44cf

View File

@ -198,10 +198,32 @@ namespace findMSB
namespace findLSB namespace findLSB
{ {
template <typename genType>
struct type
{
genType Value;
genType Return;
};
type<int> const DataI32[] =
{
{0x00000001, 0},
{0x00000003, 0},
{0x00000002, 1},
{0x80000000, 31}
};
int test() int test()
{ {
int Error(0); int Error(0);
for(std::size_t i = 0; i < sizeof(DataI32) / sizeof(type<int>); ++i)
{
int Result = glm::findLSB(DataI32[i].Value);
Error += DataI32[i].Return == Result ? 0 : 1;
assert(!Error);
}
return Error; return Error;
} }
}//findLSB }//findLSB