git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH/RFC 3/1] Makefile: BLK_SHA1 does not require fast htonl() and unaligned loads

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 23, 2012, 06:29 UTC
Message-ID
<20120723062914.GA14045@burratino>
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
Previous: Junio C Hamano
Message 9 of 9 in “block-sha1: avoid pointer conversion that violates alignment constraints”
  1. 0/2 block-sha1: avoid pointer conversion that violates alignment constraintsJonathan Nieder, Jul 22, 2012
  2. 1/2 block-sha1: avoid pointer conversion that violates alignment constraintsJonathan Nieder, Jul 22, 2012
  3. 2/2 block-sha1: put expanded macro parameters in parenthesesJonathan Nieder, Jul 22, 2012
  4. Junio C HamanoJul 23, 2012
  5. Jonathan NiederJul 23, 2012
  6. Junio C HamanoJul 23, 2012
  7. Jonathan NiederJul 23, 2012
  8. Junio C HamanoJul 23, 2012
  9. 3/1 Makefile: BLK_SHA1 does not require fast htonl() and unaligned loadsJonathan Nieder, Jul 23, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.