Git Product home page Git Product logo

Comments (2)

kr avatar kr commented on September 23, 2024

According to Colin Percival (designer of bsdiff), it is not possible:

In case anyone was wondering: bspatch doesn't have a -R option because making bsdiff patches reversible would make them considerably larger.

But if you wanted, instead of producing one patch (from V0.1 to V0.2), you could produce two patches (going in both directions), and then use whichever one you need in a given situation.

I hope this helps!

from binarydist.

kr avatar kr commented on September 23, 2024

P.S. Here's why.

There are two important operations a binary patch does: insert some bytes and delete some bytes. (There can be other operations, but at least we need these two.)

When inserting bytes, the patch needs to tell us the bytes to be inserted, as well as where to put them. For example, if v1 is go west, the patch "insert south at position 3" would produce go southwest as v2.

When deleting bytes, it can save space by saying how many bytes to be deleted, as well as where to delete them, without repeating the deleted bytes themselves. For example, with v2 go southwest, the patch "delete 4 bytes at position 8" would produce go south as v3.

To reverse a patch, we swap "insert" and "delete". For the first patch above, that's easy. We change it to "delete 5 bytes at position 3". Applying this to v2 gives us v1 again. But for the other patch, what do we do? We know it should look like "insert XXXX at position 8" but what are those 4 bytes? If all we have is v3 and the un-reversed patch, we don't know what to put in the XXXX part.

from binarydist.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.