X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=block-sha1%2Fsha1.c;h=d8934757a5e5e259f26c4a09f7ea5d10615df0c1;hb=6e31f3dbb59c70cae04be3a1fc620e16d247e7d7;hp=464cb258aaa11786d3615a55c0ae8dff95150667;hpb=24343c609926e0163c9956b89c010e907fe755ee;p=git.git diff --git a/block-sha1/sha1.c b/block-sha1/sha1.c index 464cb258a..d8934757a 100644 --- a/block-sha1/sha1.c +++ b/block-sha1/sha1.c @@ -1,15 +1,17 @@ /* - * Based on the Mozilla SHA1 (see mozilla-sha1/sha1.c), - * optimized to do word accesses rather than byte accesses, + * SHA1 routine optimized to do word accesses rather than byte accesses, * and to avoid unnecessary copies into the context array. + * + * This was initially based on the Mozilla SHA1 implementation, although + * none of the original Mozilla code remains. */ -#include -#include +/* this is only to get definitions for memcpy(), ntohl() and htonl() */ +#include "../git-compat-util.h" #include "sha1.h" -#if defined(__i386__) || defined(__x86_64__) +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) /* * Force usage of rol or ror by selecting the one with the smaller constant. @@ -54,7 +56,7 @@ #if defined(__i386__) || defined(__x86_64__) #define setW(x, val) (*(volatile unsigned int *)&W(x) = (val)) -#elif defined(__arm__) +#elif defined(__GNUC__) && defined(__arm__) #define setW(x, val) do { W(x) = (val); __asm__("":::"memory"); } while (0) #else #define setW(x, val) (W(x) = (val))