[PATCH 3/3] ewah: support platforms that require aligned reads

2014-01-23 Thread Jeff King
From: Vicent Marti tan...@gmail.com The caller may hand us an unaligned buffer (e.g., because it is an mmap of a file with many ewah bitmaps). On some platforms (like SPARC) this can cause a bus error. We can fix it with a combination of get_be32 and moving the data into an aligned buffer (which

Re: [PATCH 3/3] ewah: support platforms that require aligned reads

2014-01-23 Thread Jonathan Nieder
Jeff King wrote: --- a/ewah/ewah_io.c +++ b/ewah/ewah_io.c @@ -112,23 +112,38 @@ int ewah_serialize(struct ewah_bitmap *self, int fd) [...] +#if __BYTE_ORDER != __BIG_ENDIAN Is this portable? On a platform without __BYTE_ORDER or __BIG_ENDIAN defined, it is interpreted as #if 0 !=

Re: [PATCH 3/3] ewah: support platforms that require aligned reads

2014-01-23 Thread Vicent Martí
On Fri, Jan 24, 2014 at 12:44 AM, Jonathan Nieder jrnie...@gmail.com wrote: --- a/ewah/ewah_io.c +++ b/ewah/ewah_io.c @@ -112,23 +112,38 @@ int ewah_serialize(struct ewah_bitmap *self, int fd) [...] +#if __BYTE_ORDER != __BIG_ENDIAN Is this portable? We explicitly set the __BYTE_ORDER

Re: [PATCH 3/3] ewah: support platforms that require aligned reads

2014-01-23 Thread Jonathan Nieder
Vicent Martí wrote: On Fri, Jan 24, 2014 at 12:44 AM, Jonathan Nieder jrnie...@gmail.com wrote: +#if __BYTE_ORDER != __BIG_ENDIAN Is this portable? We explicitly set the __BYTE_ORDER macros in `compat/bswap.h`. In fact, this preprocessor conditional is the same one that we use when