Esempio n. 1
0
        private static void UndiffItem(BaseSnapObject past, int[] inputData,
                                       int inputOffset, BaseSnapObject newItem)
        {
            var pastData = past.Serialize();
            var newData  = new int[pastData.Length];

            for (int i = 0; i < past.SerializeLength; i++)
            {
                newData[i] = pastData[i] + inputData[inputOffset + i];
            }

            newItem.Deserialize(newData, 0);
        }
Esempio n. 2
0
        private static int DiffItem(BaseSnapObject past, BaseSnapObject current,
                                    int[] outputData, int outputOffset)
        {
            var needed      = 0;
            var pastData    = past.Serialize();
            var currentdata = current.Serialize();

            for (int i = 0; i < current.SerializeLength; i++)
            {
                var @out = currentdata[i] - pastData[i];
                needed |= @out;
                outputData[outputOffset++] = @out;
            }

            return(needed);
        }
Esempio n. 3
0
 public SnapshotItem(int key, int size, BaseSnapObject obj)
 {
     Size   = size;
     Key    = key;
     Object = obj;
 }