本文整理汇总了C#中BufferChunk.SetPaddedUInt64方法的典型用法代码示例。如果您正苦于以下问题:C# BufferChunk.SetPaddedUInt64方法的具体用法?C# BufferChunk.SetPaddedUInt64怎么用?C# BufferChunk.SetPaddedUInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BufferChunk
的用法示例。
在下文中一共展示了BufferChunk.SetPaddedUInt64方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XORData
/// <summary>
/// This method creates a buffer chunk containing the XOR of all the
/// buffer chunks passed in parameter.
/// The lenght of the checksum buffer is the lenght of the larger
/// buffer chunk.
/// This method can be used for encoding to generate the checksum packet
/// as well as for decoding to generate the missing packet
/// </summary>
/// <param name="bytes">array of buffer chunk</param>
/// <returns>array of buffer chunk containing only one item: the XOR row by row
/// of all the others buffer chunks</returns>
/// <remarks>
/// This method accept null entries in the array because the decoder will
/// certainly place an array with a missing packet to recover.
/// There is no validation done in this method in order to have it generic
/// because the validation rules are different on the encoder and decoder
/// </remarks>
private void XORData(BufferChunk xorData, int xorDataLength)
{
// Keep track of the tail of the array so we don't have to look it up each time
int acTail = cActiveColumns - 1;
// Create the XOR checksum packet
for(int row = 0; row < xorDataLength; row += 8)
{
// Each BufferChunk can have a different size
// Virtually remove all columns that are too short to continue, this improves performance
while(activeColumns[acTail].Length <= row)
{
acTail--;
}
UInt64 xorValue = 0;
for(int i = 0; i <= acTail; i++) // <= because acTail has already been adjusted - 1
{
// XOR operation on the current row/column
xorValue ^= activeColumns[i].GetPaddedUInt64(row);
}
// Set the value of the checksum packet for the current row
xorData.SetPaddedUInt64(row, xorValue);
}
}