Example #1
0
 void testBitsetHelpers()
 {
     CPPUNIT_ASSERT_EQUAL(0U, countTrailingUnsetBits(1));
     CPPUNIT_ASSERT_EQUAL(31U, countLeadingUnsetBits(1));
     CPPUNIT_ASSERT_EQUAL(1U, getMostSignificantBit(1));
     CPPUNIT_ASSERT_EQUAL(4U, countTrailingUnsetBits(0x110));
     CPPUNIT_ASSERT_EQUAL(23U, countLeadingUnsetBits(0x110));
     CPPUNIT_ASSERT_EQUAL(9U, getMostSignificantBit(0x110));
     CPPUNIT_ASSERT_EQUAL(0U, countTrailingUnsetBits(0xFFFFFFFFU));
     CPPUNIT_ASSERT_EQUAL(0U, countLeadingUnsetBits(0xFFFFFFFFU));
     CPPUNIT_ASSERT_EQUAL(32U, getMostSignificantBit(0xFFFFFFFFU));
 }
Example #2
0
 unsigned getRespondingSubChannel() const // NOTE - 0 based
 {
     dbgassertex(retries);
     unsigned bitpos = countTrailingUnsetBits((unsigned) retries);
     return bitpos / SUBCHANNEL_BITS;
 }