internal virtual bool CanCache(int length, ObjectToPack src, ObjectToPack res)
 {
     // If the cache would overflow, don't store.
     //
     if (0 < size && size < used + length)
     {
         CheckForGarbageCollectedObjects();
         if (0 < size && size < used + length)
         {
             return(false);
         }
     }
     if (length < entryLimit)
     {
         used += length;
         return(true);
     }
     // If the combined source files are multiple megabytes but the delta
     // is on the order of a kilobyte or two, this was likely costly to
     // construct. Cache it anyway, even though its over the limit.
     //
     if (length >> 10 < (src.GetWeight() >> 20) + (res.GetWeight() >> 21))
     {
         used += length;
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 private static long EstimateSize(ObjectToPack ent)
 {
     return DeltaIndex.EstimateIndexSize(ent.GetWeight());
 }
 /// <returns>estimated unpacked size of the object, in bytes .</returns>
 internal virtual int Size()
 {
     return(@object.GetWeight());
 }
Exemplo n.º 4
0
 private static long EstimateSize(ObjectToPack ent)
 {
     return(DeltaIndex.EstimateIndexSize(ent.GetWeight()));
 }