Subject: Re: [PATCH v4 08/23] ewah: compressed bitmap implementation

From: Jonathan Nieder <[email-masked]>
Date: Thu, 23 Jan 2014 12:23:42 -0800

Jeff King wrote:

>                                                              If we
> change the signature of align_ntohl, we can do this:
>
>   uint32_t align_ntohl(void *ptr)
>   {
>           uint32_t x;
>           memcpy(x, ptr, sizeof(x));
>           return ntohl(x);
>   }
>
>   ...
>
>   foo = align_ntohl(ptr);
>
> The memcpy solution is taken from read-cache.c, but as we noted, it
> probably hasn't been used a lot. The blk_sha1 get_be may be faster, as
> it converts as it reads.

I doubt there's much difference either way, especially after an
optimizer gets its hands on it.  According to [1] ARM has no fast
byte swap instruction so with -O0 the byte-at-a-time implementation is
probably faster there.  I can try a performance test if you like.

Jonathan

[1] http://thread.gmane.org/gmane.comp.version-control.git/125737