1 /* -*- Mode: C++ -*- */
2 static size_t CmpDifferentBlockBytes(const Block &a, const Block &b) {
5 size_t m = min(a.Size(), b.Size());
13 total += a.Size() - i;
14 total += b.Size() - i;
19 static xoff_t CmpDifferentBytes(const FileSpec &a, const FileSpec &b) {
20 Block block_a, block_b;
22 typename FileSpec::iterator a_i(a), b_i(b);
24 for (; !a_i.Done() && !b_i.Done(); a_i.Next(), b_i.Next()) {
29 total += CmpDifferentBlockBytes(block_a, block_b);
32 for (; !a_i.Done(); a_i.Next()) {
33 total += a_i.BytesOnBlock();
35 for (; !b_i.Done(); b_i.Next()) {
36 total += b_i.BytesOnBlock();
42 static size_t CmpDifferentBlockBytesAtOffset(const Block &a,
43 const FileSpec &b_spec,
46 size_t size = a.Size();
47 CHECK_LE(offset, b_spec.Size());
48 if (b_spec.Size() < offset + size) {
49 size = b_spec.Size() - offset;
51 b_spec.Get(&b, offset, size);
52 return CmpDifferentBlockBytes(a, b);