本文整理汇总了C++中BitVector::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ BitVector::Write方法的具体用法?C++ BitVector::Write怎么用?C++ BitVector::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitVector
的用法示例。
在下文中一共展示了BitVector::Write方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Test_bitVectorWrite
void BitVector_Test::Test_bitVectorWrite()
{
BitVector<256>* bits = setup();
bits->Write(16, 32, 0xa0a0b0b0);
assert(bits->Read(0, 32) == 0x2468a0a0);
assert(bits->Read(32, 32) == 0xb0b01314);
assert(bits->Read(224, 32) == 0xfedbca09);
}
示例2: Test_bitVectorSplitWrites
void BitVector_Test::Test_bitVectorSplitWrites()
{
BitVector<64> bits;
// Nothing in there to start
assert(bits.Read(0,32) == 0);
assert(bits.Read(32,32) == 0);
// Write four bits in bottom of 0 and 12 into top of 1
bits.Write(28,16,0x1234);
assert(bits.Read(0,32) == 0x1);
assert(bits.Read(32,32) == 0x23400000);
}
示例3: Test_bitVectorReadWriteBV
void BitVector_Test::Test_bitVectorReadWriteBV()
{
BitVector<256> bits; // 0 init
BitVector<4> dig;
BitVector<32> dug;
for (u32 i = 0; i <16; ++i)
{
dig.Write(0,4,i);
bits.WriteBV(i*4, dig);
}
bits.ReadBV(0, dug);
assert(dug.Read( 0,32) == 0x01234567);
bits.ReadBV(32, dug);
assert(dug.Read( 0,32) == 0x89abcdef);
bits.ReadBV(48, dug);
assert(dug.Read( 0,32) == 0xcdef0000);
BitVector<100> big;
bits.ReadBV(0, big);
big.Write(100 - 4, 4, 0xe);
bits.WriteBV(4,big);
bits.WriteBV(128,big);
assert(bits.Read( 0,32) == 0x00123456);
assert(bits.Read( 32,32) == 0x789abcde);
assert(bits.Read( 64,32) == 0xf0000000);
assert(bits.Read( 96,32) == 0x0e000000);
assert(bits.Read(128,32) == 0x01234567);
assert(bits.Read(160,32) == 0x89abcdef);
assert(bits.Read(192,32) == 0x00000000);
assert(bits.Read(224,32) == 0xe0000000);
}
示例4: Test_RunTests
void BitVector_Test::Test_RunTests() {
{
BitVector<0> zeroSizeShouldCompileOK;
assert(sizeof(zeroSizeShouldCompileOK) * 8 == BitVector<256>::BITS_PER_UNIT);
assert(zeroSizeShouldCompileOK.Read(0, 0) == 0); // Only legal read args
zeroSizeShouldCompileOK.Write(0, 0, 0x87654321); // Ignored
assert(zeroSizeShouldCompileOK.Read(0, 0) == 0); // Still nothing there
}
Test_bitVectorCtors();
Test_bitVectorLong();
Test_bitVectorAllocate();
Test_bitVectorRead();
Test_bitVectorSize();
Test_bitVectorWrite();
Test_bitVectorSplitWrites();
Test_bitVectorSetAndClearBits();
Test_bitVectorStoreBits();
Test_bitVectorReadWriteBV();
Test_bitVectorPopulationCount();
}
示例5: Test_bitVectorWrite
void BitVector_Test::Test_bitVectorWrite()
{
BitVector<256>* bits = setup();
bits->Write(16, 32, 0xa0a0b0b0);
assert(bits->Read(0, 32) == 0x2468a0a0);
assert(bits->Read(32, 32) == 0xb0b01314);
assert(bits->Read(224, 32) == 0xfedbca09);
// WriteBig
{
BitVector<256>* bb = setup();
u32 fooBits[] = {0xabc123ee,0x55667788,0x01020304};
BV96 foo(fooBits);
bb->WriteBig(0,32,foo);
assert(bits->Read(0, 32) == 0xabc123ee);
assert(bits->Read(32, 32) == 0x11121314);
assert(bits->Read(64, 32) == 0x12345678);
bb->WriteBig(64,64,foo);
assert(bits->Read(0, 32) == 0xabc123ee);
assert(bits->Read(32, 32) == 0x11121314);
assert(bits->Read(64, 32) == 0xabc123ee);
assert(bits->Read(96, 32) == 0x55667788);
assert(bits->Read(128, 32) == 0x0fedcba9);
bb->WriteBig(32,96,foo);
assert(bits->Read(0, 32) == 0xabc123ee);
assert(bits->Read(32, 32) == 0xabc123ee);
assert(bits->Read(64, 32) == 0x55667788);
assert(bits->Read(96, 32) == 0x01020304);
assert(bits->Read(128, 32) == 0x0fedcba9);
}
}