Re: [PATCH 1/2] compat: move unaligned helpers to bswap.h
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jan 23, 2014, 19:56 UTC
- Message-ID
- <20140123195643.GV18964@google.com>
- In-Reply-To
- <20140123194401.GA31412@sigill.intra.peff.net>
Jeff King wrote:
> I think it was a bug waiting to surface if index v4 ever got wide use.
Ah, ok.
In that case I think git-compat-util.h should include something like what block-sha1/sha1.c has:
#if !defined(__i386__) && !defined(__x86_64__) && \ !defined(_M_IX86) && !defined(_M_X64) && \ !defined(__ppc__) && !defined(__ppc64__) && \ !defined(__powerpc__) && !defined(__powerpc64__) && \ !defined(__s390__) && !defined(__s390x__) #define NEEDS_ALIGNED_ACCESS #endif
Otherwise we are relying on the person building to know their own architecture intimately, which shouldn't be necessary.
Meanwhile, as mentioned in the other message, I suspect the NEEDS_ALIGNED_ACCESS code path is broken for aggressive compilers anyway. Looking more.
Thanks, Jonathan