本文整理汇总了C#中ZXing.Common.BitArray.xor方法的典型用法代码示例。如果您正苦于以下问题:C# BitArray.xor方法的具体用法?C# BitArray.xor怎么用?C# BitArray.xor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZXing.Common.BitArray
的用法示例。
在下文中一共展示了BitArray.xor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: makeTypeInfoBits
/// <summary>
/// Make bit vector of type information. On success, store the result in "bits" and return true.
/// Encode error correction level and mask pattern. See 8.9 of
/// JISX0510:2004 (p.45) for details.
/// </summary>
/// <param name="ecLevel">The ec level.</param>
/// <param name="maskPattern">The mask pattern.</param>
/// <param name="bits">The bits.</param>
public static void makeTypeInfoBits(ErrorCorrectionLevel ecLevel, int maskPattern, BitArray bits)
{
if (!QRCode.isValidMaskPattern(maskPattern))
{
throw new WriterException("Invalid mask pattern");
}
int typeInfo = (ecLevel.Bits << 3) | maskPattern;
bits.appendBits(typeInfo, 5);
int bchCode = calculateBCHCode(typeInfo, TYPE_INFO_POLY);
bits.appendBits(bchCode, 10);
BitArray maskBits = new BitArray();
maskBits.appendBits(TYPE_INFO_MASK_PATTERN, 15);
bits.xor(maskBits);
if (bits.Size != 15)
{
// Just in case.
throw new WriterException("should not happen but we got: " + bits.Size);
}
}
示例2: testXOR
public void testXOR()
{
var v1 = new BitArray();
v1.appendBits(0x5555aaaa, 32);
var v2 = new BitArray();
v2.appendBits(-1431677611, 32); // 0xaaaa5555
v1.xor(v2);
Assert.AreEqual(0xffffffffL, getUnsignedInt(v1, 0));
}
示例3: testXOR2
public void testXOR2()
{
var v1 = new BitArray();
v1.appendBits(0x2a, 7); // 010 1010
var v2 = new BitArray();
v2.appendBits(0x55, 7); // 101 0101
v1.xor(v2);
Assert.AreEqual(0xfe000000L, getUnsignedInt(v1, 0)); // 1111 1110
}
示例4: testXOR
public void testXOR()
{
{
BitArray v1 = new BitArray();
v1.appendBits(0x5555aaaa, 32);
BitArray v2 = new BitArray();
v2.appendBits(-1431677611, 32); // 0xaaaa5555
v1.xor(v2);
Assert.AreEqual(0xffffffffL, getUnsignedInt(v1, 0));
}
{
BitArray v1 = new BitArray();
v1.appendBits(0x2a, 7); // 010 1010
BitArray v2 = new BitArray();
v2.appendBits(0x55, 7); // 101 0101
v1.xor(v2);
Assert.AreEqual(0xfe000000L, getUnsignedInt(v1, 0)); // 1111 1110
}
}