git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Michael Cree <mcree@orcon.net.nz>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Nicolas Pitre <nico@fluxnic.net>
Subject: [PATCH/RFC 3/1] Makefile: BLK_SHA1 does not require fast htonl() and unaligned loads
Date: Mon, 23 Jul 2012 01:29:14 -0500	[thread overview]
Message-ID: <20120723062914.GA14045@burratino> (raw)
In-Reply-To: <7vboj7nidc.fsf@alter.siamese.dyndns.org>

block-sha1/ is fast on most known platforms.  Clarify the Makefile to
be less misleading about that.

Early versions of block-sha1/ explicitly relied on fast htonl() and
fast 32-bit loads with arbitrary alignment.  Now it uses those on some
arches but the default behavior is byte-at-a-time access for the sake
of arches like ARM, Alpha, and their kin and it is still pretty fast
on these arches (fast enough to supersede the mozilla SHA1
implementation and the hand-written ARM assembler implementation that
were bundled before).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Junio C Hamano wrote:

> *1* In other words, the ntohl(*(uint *)(p)) is used only on selected
> little endian boxes, but that does not mean the generic code was
> big-endian only.  Little endian boxes that are not listed in #if
> block do use the generic byte-at-a-time macro.

Oh, that reminds me.  Here's a third patch.

 Makefile |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 134606b9..eadcc70a 100644
--- a/Makefile
+++ b/Makefile
@@ -84,9 +84,8 @@ all::
 # specify your own (or DarwinPort's) include directories and
 # library directories by defining CFLAGS and LDFLAGS appropriately.
 #
-# Define BLK_SHA1 environment variable if you want the C version
-# of the SHA1 that assumes you can do unaligned 32-bit loads and
-# have a fast htonl() function.
+# Define BLK_SHA1 environment variable to make use of the bundled
+# optimized C SHA1 routine.
 #
 # Define PPC_SHA1 environment variable when running make to make use of
 # a bundled SHA1 routine optimized for PowerPC.
-- 
1.7.10.4

      reply	other threads:[~2012-07-23  6:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-22 23:35 [PATCH lt/block-sha1 0/2 v3] block-sha1: avoid pointer conversion that violates alignment constraints Jonathan Nieder
2012-07-22 23:39 ` [PATCH 1/2] " Jonathan Nieder
2012-07-22 23:40 ` [PATCH 2/2] block-sha1: put expanded macro parameters in parentheses Jonathan Nieder
2012-07-23  4:28 ` [PATCH lt/block-sha1 0/2 v3] block-sha1: avoid pointer conversion that violates alignment constraints Junio C Hamano
2012-07-23  4:51   ` Jonathan Nieder
2012-07-23  5:10     ` Junio C Hamano
2012-07-23  5:28       ` Jonathan Nieder
2012-07-23  5:42         ` Junio C Hamano
2012-07-23  6:29           ` Jonathan Nieder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120723062914.GA14045@burratino \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mcree@orcon.net.nz \
    --cc=nico@fluxnic.net \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).