Skip to content

Commit

Permalink
block-sha1: guard gcc extensions with __GNUC__
Browse files Browse the repository at this point in the history
With this, the code should now be portable to any C compiler.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nicolas Pitre authored and gitster committed Aug 18, 2009
1 parent 51ea551 commit e9c5dcd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block-sha1/sha1.c
Expand Up @@ -9,7 +9,7 @@


#include "sha1.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. * Force usage of rol or ror by selecting the one with the smaller constant.
Expand Down Expand Up @@ -54,7 +54,7 @@


#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)
#define setW(x, val) (*(volatile unsigned int *)&W(x) = (val)) #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) #define setW(x, val) do { W(x) = (val); __asm__("":::"memory"); } while (0)
#else #else
#define setW(x, val) (W(x) = (val)) #define setW(x, val) (W(x) = (val))
Expand Down

0 comments on commit e9c5dcd

Please sign in to comment.