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


C# BufferChunk.SetPaddedUInt64方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:psyCHOder,项目名称:conferencexp,代码行数:43,代码来源:fec.cs


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