Re: [PATCH 1/2] compat: move unaligned helpers to bswap.h
- From
Jeff King <peff@peff.net>
- Date
- Jan 23, 2014, 19:44 UTC
- Message-ID
- <20140123194401.GA31412@sigill.intra.peff.net>
- In-Reply-To
- <20140123194118.GT18964@google.com>
On Thu, Jan 23, 2014 at 11:41:18AM -0800, Jonathan Nieder wrote:
Show 13 quoted lines
> Jeff King wrote: > > > Commit d60c49c (read-cache.c: allow unaligned mapping of the > > index file, 2012-04-03) introduced helpers to access > > unaligned data. Let's factor them out to make them more > > widely available. > > > > While we're at it, we'll give the helpers more readable > > names, add a helper for the "ntohll" form, and add the > > appropriate Makefile knob. > > Weird. Why wasn't git broken on the relevant platforms before (given > that no one has been setting NEEDS_ALIGNED_ACCESS for them)?
Because most of our data structures support aligned access. Thomas mentioned this as a potential issue earlier, and I said in a re-roll cover letter:
I did not include the NEEDS_ALIGNED_ACCESS patch. I note that we do not even have a Makefile knob for this, and the code in read-cache.c has probably never actually been used. Are there real systems that have a problem? The read-cache code was in support of the index v4 experiment, which did away with the 8-byte padding. So it could be that we simply don't see it, because everything is currently aligned.
I think it was a bug waiting to surface if index v4 ever got wide use.
-Peff