Esempio n. 1
0
        private void TestEncodeDecodeMinDelta64 <T>(int count, Func <int, T[]> factory, int skip)
            where T : unmanaged
        {
            var chunk  = factory(count);
            var result = new T[count];

            var size   = CodecExt.GetMaxEncodedSizeForMinDeltaU64(chunk.Length);
            var buffer = new UnsafeBuffer(size);

            fixed(T *p = chunk)
            {
                var dst = buffer.Ptr;

                CodecExt.EncodeMinDeltaU64((byte *)p, count * sizeof(T), skip, ref dst);
            }

            fixed(T *p = result)
            {
                var src = buffer.Ptr;

                CodecExt.DecodeMinDeltaU64(ref src, skip, (byte *)p);
            }

            chunk.IsEqualTo(result);
        }
Esempio n. 2
0
 public int GetMaxEncodedSize(int count)
 {
     return(CodecExt.GetMaxEncodedSizeForMinDeltaU64(count)
            + Codec.MAX_INT32_LENGTH * (count + 2));
 }