当前位置: 首页>>代码示例>>C++>>正文


C++ BitVector::Write方法代码示例

本文整理汇总了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);
  }
开发者ID:EStallings,项目名称:MFMv2,代码行数:10,代码来源:BitVector_Test.cpp

示例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);

  }
开发者ID:EStallings,项目名称:MFMv2,代码行数:14,代码来源:BitVector_Test.cpp

示例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);
  }
开发者ID:DaveAckley,项目名称:MFM,代码行数:37,代码来源:BitVector_Test.cpp

示例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();
  }
开发者ID:DaveAckley,项目名称:MFM,代码行数:22,代码来源:BitVector_Test.cpp

示例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);

    }

  }
开发者ID:DaveAckley,项目名称:MFM,代码行数:38,代码来源:BitVector_Test.cpp


注:本文中的BitVector::Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。