コード例 #1
0
ファイル: ZigZag.cs プロジェクト: l0nley/integer-compression
        // <summary>
        /// Decode an array of unsigned longs into a ZigZag encoded array of signed longs.
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        public static Int64[] Decode(UInt64[] values)
        {
            var output = new Int64[values.Length];

            for (var i = 0; i < values.Length; i++)
            {
                output[i] = ZigZag.Decode(values[i]);
            }
            return(output);
        }
コード例 #2
0
        public IEnumerable <Int64> DecompressSigned(Stream input, Int32 count)
        {
#if DEBUG
            if (null == input)
            {
                throw new ArgumentNullException(nameof(input));
            }
            if (count < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(count));
            }
#endif

            return(DecompressUnsigned(input, count).Select(symbol => ZigZag.Decode(symbol)));
        }
コード例 #3
0
 /// <summary>
 /// Read the next value.
 /// </summary>
 /// <returns></returns>
 public Int64 Read()
 {
     return(ZigZag.Decode(Underlying.Read()));
 }