Use user-defined literal for k, m, and g (powers of 1024)

This commit is contained in:
Tatsuhiro Tsujikawa 2015-06-21 18:04:30 +09:00
parent 8ba9b04747
commit 318c804504
99 changed files with 482 additions and 453 deletions

View file

@ -23,7 +23,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(GeomStreamPieceSelectorTest);
void GeomStreamPieceSelectorTest::testOnBitfieldInit()
{
BitfieldMan bf(1024, 1024*20);
BitfieldMan bf(1_k, 20_k);
bf.setBitRange(0, 10);
GeomStreamPieceSelector sel(&bf, 2);
sel.onBitfieldInit();
@ -31,19 +31,19 @@ void GeomStreamPieceSelectorTest::testOnBitfieldInit()
memset(igbf, 0, 3);
size_t index;
// 11111|11111|00000|00000
CPPUNIT_ASSERT(sel.select(index, 1024*20, igbf, sizeof(igbf)));
CPPUNIT_ASSERT(sel.select(index, 20_k, igbf, sizeof(igbf)));
CPPUNIT_ASSERT_EQUAL((size_t)11, index);
bf.setUseBit(11);
// 11111|11111|10000|00000
CPPUNIT_ASSERT(sel.select(index, 1024*20, igbf, sizeof(igbf)));
CPPUNIT_ASSERT(sel.select(index, 20_k, igbf, sizeof(igbf)));
CPPUNIT_ASSERT_EQUAL((size_t)12, index);
bf.setUseBit(12);
// 11111|11111|11000|00000
CPPUNIT_ASSERT(sel.select(index, 1024*20, igbf, sizeof(igbf)));
CPPUNIT_ASSERT(sel.select(index, 20_k, igbf, sizeof(igbf)));
CPPUNIT_ASSERT_EQUAL((size_t)13, index);
bf.setUseBit(13);
// 11111|11111|11100|00000
CPPUNIT_ASSERT(sel.select(index, 1024*20, igbf, sizeof(igbf)));
CPPUNIT_ASSERT(sel.select(index, 20_k, igbf, sizeof(igbf)));
CPPUNIT_ASSERT_EQUAL((size_t)15, index);
}