本文整理汇总了C++中BitVector::StoreBits方法的典型用法代码示例。如果您正苦于以下问题:C++ BitVector::StoreBits方法的具体用法?C++ BitVector::StoreBits怎么用?C++ BitVector::StoreBits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitVector
的用法示例。
在下文中一共展示了BitVector::StoreBits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Test_bitVectorStoreBits
void BitVector_Test::Test_bitVectorStoreBits()
{
const u32 PATTERN = 0xdeadbeef;
BitVector<256>* bits;
bits = setup();
bits->StoreBits(PATTERN,12,32*7); // 0-7; unaligned start/end
assert(bits->Read( 0,32) == 0x246dbeef);
assert(bits->Read( 32,32) == 0xdeadbeef);
assert(bits->Read( 64,32) == 0xdeadbeef);
assert(bits->Read( 96,32) == 0xdeadbeef);
assert(bits->Read(128,32) == 0xdeadbeef);
assert(bits->Read(160,32) == 0xdeadbeef);
assert(bits->Read(192,32) == 0xdeadbeef);
assert(bits->Read(224,32) == 0xdeabca09);
bits = setup();
bits->StoreBits(PATTERN,96,12); // 3-3; single front-aligned
assertUnchanged(0,2);
assert(bits->Read( 96,32) == 0xdeacdef0);
assertUnchanged(4,7);
bits = setup();
bits->StoreBits(PATTERN,96+20,12); // 3-3; single back-aligned
assertUnchanged(0,2);
assert(bits->Read( 96,32) == 0x9abcdeef);
assertUnchanged(4,7);
bits = setup();
bits->StoreBits(PATTERN,96+8,16); // 3-3; single unaligned
assertUnchanged(0,2);
assert(bits->Read( 96,32) == 0x9aadbef0);
assertUnchanged(4,7);
}