Skip to content

Commit

Permalink
block-sha1: minor fixups
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Aug 6, 2009
1 parent b8e48a8 commit fd536d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block-sha1/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx)

#if defined(__i386__) || defined(__x86_64__)

#define SHA_ASM(op, x, n) ({ unsigned int __res; asm(op " %1,%0":"=r" (__res):"i" (n), "0" (x)); __res; })
#define SHA_ASM(op, x, n) ({ unsigned int __res; __asm__(op " %1,%0":"=r" (__res):"i" (n), "0" (x)); __res; })
#define SHA_ROL(x,n) SHA_ASM("rol", x, n)
#define SHA_ROR(x,n) SHA_ASM("ror", x, n)

#else

#define SHA_ROT(X,n) (((X) << (l)) | ((X) >> (r)))
#define SHA_ROT(X,l,r) (((X) << (l)) | ((X) >> (r)))
#define SHA_ROL(X,n) SHA_ROT(X,n,32-(n))
#define SHA_ROR(X,n) SHA_ROT(X,32-(n),n)

Expand Down

0 comments on commit fd536d3

Please sign in to comment.