block-sha1: minor fixups
Bert Wesarg noticed non-x86 version of SHA_ROT() had a typo. Also spell in-line assembly as __asm__(), otherwise I seem to get error: implicit declaration of function 'asm' from my compiler. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Aug 6, 2009 at 13:52 UTC
fd536d3439fa2a06730884df31e2e98c9006c947
1 file changed
+2
-2
block-sha1/sha1.c
+2
-2
@@ -82,13 +82,13 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx)
82
83
#if defined(__i386__) || defined(__x86_64__)
84
85
-#define SHA_ASM(op, x, n) ({ unsigned int __res; asm(op " %1,%0":"=r" (__res):"i" (n), "0" (x)); __res; })
85
+#define SHA_ASM(op, x, n) ({ unsigned int __res; __asm__(op " %1,%0":"=r" (__res):"i" (n), "0" (x)); __res; })
86
#define SHA_ROL(x,n) SHA_ASM("rol", x, n)
87
#define SHA_ROR(x,n) SHA_ASM("ror", x, n)
88
89
#else
90
91
-#define SHA_ROT(X,n) (((X) << (l)) | ((X) >> (r)))
91
+#define SHA_ROT(X,l,r) (((X) << (l)) | ((X) >> (r)))
92
#define SHA_ROL(X,n) SHA_ROT(X,n,32-(n))
93
#define SHA_ROR(X,n) SHA_ROT(X,32-(n),n)
94