git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Erik Fastermann <erik@fastermann.de>, git@vger.kernel.org
Subject: Re: Question about the pack OBJ_OFS_DELTA format
Date: Sat, 11 Jan 2020 04:56:04 -0500	[thread overview]
Message-ID: <20200111095604.GA1605786@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqq1rs7m757.fsf@gitster-ct.c.googlers.com>

On Fri, Jan 10, 2020 at 11:41:08AM -0800, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > The pack-format.txt file says:
> >
> >        offset encoding:
> >             n bytes with MSB set in all but the last one.
> >             The offset is then the number constructed by
> >             concatenating the lower 7 bit of each byte, and
> >             for n >= 2 adding 2^7 + 2^14 + ... + 2^(7*(n-1))
> >             to the result.
> >
> > but I think is missing two bits of information:
> >
> >   - the bytes are in most-significant to least-significant order, which
> >     IIRC is the opposite of the size varint
> >
> >   - each 7-bit byte sneaks in some extra data by implicitly adding "1"
> >     to all but the last byte
> 
> Isn't the latter mentioned in the paragraph you quoted?

Hmm, yeah. I admit I had trouble parsing exactly what that part was
trying to say, and thought it was trying to talk about how you'd shift
the individual bytes. But reading more carefully, it does say "adding",
so yeah, it accounts for the extra.

It's a little confusing, I think, because in code you'd add just
continually add one before shifting, rather than trying to add in the
extra values at the end.

-Peff

      reply	other threads:[~2020-01-11  9:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10  8:26 Question about the pack OBJ_OFS_DELTA format Erik Fastermann
2020-01-10  9:57 ` Jeff King
2020-01-10 13:56   ` Erik Fastermann
2020-01-10 19:41   ` Junio C Hamano
2020-01-11  9:56     ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200111095604.GA1605786@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=erik@fastermann.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).