本文整理汇总了C#中System.Numerics.BigInteger.ToUInt32Array方法的典型用法代码示例。如果您正苦于以下问题:C# BigInteger.ToUInt32Array方法的具体用法?C# BigInteger.ToUInt32Array怎么用?C# BigInteger.ToUInt32Array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Numerics.BigInteger
的用法示例。
在下文中一共展示了BigInteger.ToUInt32Array方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToUInt32Array_BigInteger_ComputesCorrectly
public void ToUInt32Array_BigInteger_ComputesCorrectly()
{
var testValue = new BigInteger(new byte[] {
0x5A, 0x53, 0x08, 0x8E,
0x00, 0x00, 0x00, 0x00,
0x46, 0xaa, 0xef, 0x01,
0x5f, 0xdb, 0xca, 0x0d
});
var expected = new[] { 2382910298U, 0U, 32483910U, 231398239U };
Assert.Equal(expected, testValue.ToUInt32Array(128));
}
示例2: ToUInt32Array_BigInteger_InvalidBitSize_Throws
public void ToUInt32Array_BigInteger_InvalidBitSize_Throws()
{
var invalidBitSizes = new[] { -1, 16, 31, 48, 65 };
var testValue = new BigInteger(0);
foreach (var invalidBitSize in invalidBitSizes)
{
Assert.Equal("bitSize",
Assert.Throws<ArgumentOutOfRangeException>(
() => testValue.ToUInt32Array(invalidBitSize))
.ParamName);
}
}
示例3: ToUInt32Array_BigInteger_ValidBitSize_DoesNotThrow
public void ToUInt32Array_BigInteger_ValidBitSize_DoesNotThrow()
{
var invalidBitSizes = new[] { -1, 16, 31, 48, 65 };
var testValue = new BigInteger(0);
foreach (var uint32Count in Enumerable.Range(0, 32).Select(i => i * 32))
{
UInt32[] resultArray = null;
resultArray = testValue.ToUInt32Array(uint32Count * 32);
Assert.Equal(uint32Count, resultArray.Length);
}
}
示例4: FNVPrimeOffset
/// <summary>
/// Initializes a new instance of the <see cref="FNVPrimeOffset"/> class.
/// </summary>
/// <param name="bitSize">Number of bits the prime and offset use each.</param>
/// <param name="prime">Prime integer to be represented.</param>
/// <param name="offset">Offset integer to be represented.</param>
public FNVPrimeOffset(int bitSize, BigInteger prime, BigInteger offset)
{
Prime = prime.ToUInt32Array(bitSize);
Offset = offset.ToUInt32Array(bitSize);
}