src/base/intmath.test.cc
/** This is testing if log2i actually works.
 * at every iteration value is multiplied by 2 (left shift) and expected
 * is incremented by one. This until value reaches becomes negative (by
 * left shifting) which is when expected points to the MSB
 */
This is testing if log2i actually works.
at every iteration value is multiplied by 2 (left shift) and expected
is incremented by one. This until value reaches becomes negative (by
left shifting) which is when expected points to the MSB
This is testing if log2i actually works . at every iteration value is multiplied by 2 ( left shift ) and expected is incremented by one . This until value reaches becomes negative ( by left shifting ) which is when expected points to the MSB
TEST(IntmathTest, Log2i)
{
    int expected = 0;
    for (int value = 1; value > 0; expected++, value <<= 1) {
        EXPECT_EQ(expected, log2i(value));
    }
    EXPECT_EQ(expected, sizeof(int) * 8 - 1);
}
TEST ( IntmathTest , Log2i ) { int expected = 0 ; for ( int value = 1 ; value > 0 ; expected ++ , value <<= 1 ) { EXPECT_EQ ( expected , log2i ( value ) ) ; } EXPECT_EQ ( expected , sizeof ( int ) * 8 - 1 ) ; }
This is testing if log2i actually works.
This is testing if log2i actually works .
// Just as a sanity check for expected to point to the MSB