<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/block-sha1, branch v1.8.0.2</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.8.0.2</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.8.0.2'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2012-07-24T03:56:47Z</updated>
<entry>
<title>Merge branch 'jn/block-sha1'</title>
<updated>2012-07-24T03:56:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-07-24T03:56:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=ebcfa444c436c0a501d38ffd5bae670fe6ee01c5'/>
<id>urn:sha1:ebcfa444c436c0a501d38ffd5bae670fe6ee01c5</id>
<content type='text'>
The code to load a word one-byte-at-a-time was optimized into a
word-wide load instruction even when the pointer was not aligned,
which caused issues on architectures that do not like unaligned
access.

* jn/block-sha1:
  Makefile: BLK_SHA1 does not require fast htonl() and unaligned loads
  block-sha1: put expanded macro parameters in parentheses
  block-sha1: avoid pointer conversion that violates alignment constraints
</content>
</entry>
<entry>
<title>block-sha1: put expanded macro parameters in parentheses</title>
<updated>2012-07-23T04:13:53Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2012-07-22T23:40:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=23119ffb4ea91cdf30016254df60e1adc64b478c'/>
<id>urn:sha1:23119ffb4ea91cdf30016254df60e1adc64b478c</id>
<content type='text'>
't' is currently always a numeric constant, but it can't hurt to
prepare for the day that it becomes useful for a caller to pass in a
more complex expression.

Suggested-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>block-sha1: avoid pointer conversion that violates alignment constraints</title>
<updated>2012-07-23T04:11:35Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2012-07-22T23:39:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=5f6a11259ab0045a9f79bd789393de7a77e3c5d6'/>
<id>urn:sha1:5f6a11259ab0045a9f79bd789393de7a77e3c5d6</id>
<content type='text'>
With 660231aa (block-sha1: support for architectures with memory
alignment restrictions, 2009-08-12), blk_SHA1_Update was modified to
access 32-bit chunks of memory one byte at a time on arches that
prefer that:

	#define get_be32(p)    ( \
		(*((unsigned char *)(p) + 0) &lt;&lt; 24) | \
		(*((unsigned char *)(p) + 1) &lt;&lt; 16) | \
		(*((unsigned char *)(p) + 2) &lt;&lt;  8) | \
		(*((unsigned char *)(p) + 3) &lt;&lt;  0) )

The code previously accessed these values by just using htonl(*p).

Unfortunately, Michael noticed on an Alpha machine that git was using
plain 32-bit reads anyway.  As soon as we convert a pointer to int *,
the compiler can assume that the object pointed to is correctly
aligned as an int (C99 section 6.3.2.3 "pointer conversions"
paragraph 7), and gcc takes full advantage by using a single 32-bit
load, resulting in a whole bunch of unaligned access traps.

So we need to obey the alignment constraints even when only dealing
with pointers instead of actual values.  Do so by changing the type
of 'data' to void *.  This patch renames 'data' to 'block' at the same
time to make sure all references are updated to reflect the new type.

Reported-tested-and-explained-by: Michael Cree &lt;mcree@orcon.net.nz&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>msvc: Select the "fast" definition of the {get,put}_be32() macros</title>
<updated>2010-06-28T04:59:32Z</updated>
<author>
<name>Ramsay Jones</name>
<email>ramsay@ramsay1.demon.co.uk</email>
</author>
<published>2010-06-23T19:47:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=078e9bce1e8e2484d33d7400ae02c10954fd93ac'/>
<id>urn:sha1:078e9bce1e8e2484d33d7400ae02c10954fd93ac</id>
<content type='text'>
On Intel machines, the msvc compiler defines the CPU architecture
macros _M_IX86 and _M_X64 (equivalent to __i386__ and __x86_64__
respectively). Use these macros in the pre-processor expression
to select the "fast" definition of the {get,put}_be32() macros.

Signed-off-by: Ramsay Jones &lt;ramsay@ramsay1.demon.co.uk&gt;
Acked-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>msvc: Fix some compiler warnings</title>
<updated>2010-06-25T18:04:16Z</updated>
<author>
<name>Ramsay Jones</name>
<email>ramsay@ramsay1.demon.co.uk</email>
</author>
<published>2010-06-23T19:47:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=9eafa1201b2dcc703258ca7cd53de8ac4de74565'/>
<id>urn:sha1:9eafa1201b2dcc703258ca7cd53de8ac4de74565</id>
<content type='text'>
In particular, using the normal (or production) compiler
warning level (-W3), msvc complains as follows:

.../sha1.c(244) : warning C4018: '&lt;' : signed/unsigned mismatch
.../sha1.c(270) : warning C4244: 'function' : conversion from \
   'unsigned __int64' to 'unsigned long', possible loss of data
.../sha1.c(271) : warning C4244: 'function' : conversion from \
   'unsigned __int64' to 'unsigned long', possible loss of data

Note that gcc issues a similar complaint about line 244 when
compiling with -Wextra.

Signed-off-by: Ramsay Jones &lt;ramsay@ramsay1.demon.co.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>remove ARM and Mozilla SHA1 implementations</title>
<updated>2009-08-18T21:19:40Z</updated>
<author>
<name>Nicolas Pitre</name>
<email>nico@cam.org</email>
</author>
<published>2009-08-18T00:09:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=30ae47b4cc19dce42f51b4fa378d315a71b08957'/>
<id>urn:sha1:30ae47b4cc19dce42f51b4fa378d315a71b08957</id>
<content type='text'>
They are both slower than the new BLK_SHA1 implementation, so it is
pointless to keep them around.

Signed-off-by: Nicolas Pitre &lt;nico@cam.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>block-sha1: guard gcc extensions with __GNUC__</title>
<updated>2009-08-18T21:18:36Z</updated>
<author>
<name>Nicolas Pitre</name>
<email>nico@cam.org</email>
</author>
<published>2009-08-18T19:37:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=e9c5dcd1313dd4e2f606419ce3d228c99fae2c40'/>
<id>urn:sha1:e9c5dcd1313dd4e2f606419ce3d228c99fae2c40</id>
<content type='text'>
With this, the code should now be portable to any C compiler.

Signed-off-by: Nicolas Pitre &lt;nico@cam.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>make sure byte swapping is optimal for git</title>
<updated>2009-08-18T21:16:37Z</updated>
<author>
<name>Nicolas Pitre</name>
<email>nico@cam.org</email>
</author>
<published>2009-08-18T19:26:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=51ea55190b6e72c77c96754c1bf2f149a4714848'/>
<id>urn:sha1:51ea55190b6e72c77c96754c1bf2f149a4714848</id>
<content type='text'>
We rely on ntohl() and htonl() to perform byte swapping in many places.
However, some platforms have libraries providing really poor
implementations of those which might cause significant performance
issues, especially with the block-sha1 code.

Signed-off-by: Nicolas Pitre &lt;nico@cam.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>block-sha1: make the size member first in the context struct</title>
<updated>2009-08-18T19:26:01Z</updated>
<author>
<name>Nicolas Pitre</name>
<email>nico@cam.org</email>
</author>
<published>2009-08-18T00:18:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=d5f6a96fa4792f6143d06d9c0b572a96d7235305'/>
<id>urn:sha1:d5f6a96fa4792f6143d06d9c0b572a96d7235305</id>
<content type='text'>
This is a 64-bit value, hence having it first provides a better
alignment.

Signed-off-by: Nicolas Pitre &lt;nico@cam.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>block-sha1/sha1.c: silence compiler complaints by casting void * to char *</title>
<updated>2009-08-15T02:13:00Z</updated>
<author>
<name>Brandon Casey</name>
<email>drafnel@gmail.com</email>
</author>
<published>2009-08-14T22:52:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=a12218572f2875e91b6c3c12559b076c4949a675'/>
<id>urn:sha1:a12218572f2875e91b6c3c12559b076c4949a675</id>
<content type='text'>
Some compilers produce errors when arithmetic is attempted on pointers to
void.  We want computations done on byte addresses, so cast them to char *
to work them around.

Signed-off-by: Brandon Casey &lt;casey@nrlssc.navy.mil&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
