git/ewah
Jeff King 6b5b3a27b7 ewah: unconditionally ntohll ewah data
Commit a201c20 tried to optimize out a loop like:

  for (i = 0; i < len; i++)
	  data[i] = ntohll(data[i]);

in the big-endian case, because we know that ntohll is a
noop, and we do not need to pay the cost of the loop at all.
However, it mistakenly assumed that __BYTE_ORDER was always
defined, whereas it may not be on systems which do not
define it by default, and where we did not need to define it
to set up the ntohll macro. This includes OS X and Windows.

We could muck with the ordering in compat/bswap.h to make
sure it is defined unconditionally, but it is simpler to
still to just execute the loop unconditionally. That avoids
the application code knowing anything about these magic
macros, and lets it depend only on having ntohll defined.

And since the resulting loop looks like (on a big-endian
system):

  for (i = 0; i < len; i++)
	  data[i] = data[i];

any decent compiler can probably optimize it out.

Original report and analysis by Brian Gernhardt.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-02-12 11:21:29 -08:00
..
bitmap.c ewah: compressed bitmap implementation 2013-12-30 12:17:20 -08:00
ewah_bitmap.c ewah: compressed bitmap implementation 2013-12-30 12:17:20 -08:00
ewah_io.c ewah: unconditionally ntohll ewah data 2014-02-12 11:21:29 -08:00
ewah_rlw.c ewah: compressed bitmap implementation 2013-12-30 12:17:20 -08:00
ewok_rlw.h ewah: compressed bitmap implementation 2013-12-30 12:17:20 -08:00
ewok.h ewah: compressed bitmap implementation 2013-12-30 12:17:20 -08:00