Thread (67 messages) flat view 67 messages, 8 authors, 2016-06-15

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

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:59:44

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help