~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff-delta.c

  • Committer: John Arbash Meinel
  • Date: 2009-03-19 14:41:53 UTC
  • mto: (3735.2.157 brisbane-core)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: john@arbash-meinel.com-20090319144153-y4m58rs011omd0g3
Handle when our current packing is sub-optimal.

It happens somtimes that our estimated hsize is too big, so
that the next estimate tries to shrink it. However the code
like pack_delta_index only copes with growing, and that is
honestly all we really care about.

Show diffs side-by-side

added added

removed removed

Lines of Context:
300
300
    index->hash_mask = hmask;
301
301
    index->num_entries = num_entries;
302
302
    if (old_index) {
 
303
        if (hmask < old_index->hash_mask) {
 
304
            fprintf(stderr, "hash mask was shrunk %x => %x\n",
 
305
                            old_index->hash_mask, hmask);
 
306
        }
303
307
        assert(hmask >= old_index->hash_mask);
304
308
    }
305
309
 
389
393
    for (i = 4; (1u << i) < hsize && i < 31; i++);
390
394
    hsize = 1 << i;
391
395
    hmask = hsize - 1;
 
396
    if (old && old->hash_mask < hmask) {
 
397
        hmask = old->hash_mask;
 
398
        hsize = hmask + 1;
 
399
    }
392
400
 
393
401
    /* allocate lookup index */
394
402
    memsize = sizeof(*hash) * hsize +