summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-28 14:06:00 -0700
committerJunio C Hamano <gitster@pobox.com>2017-03-28 14:06:00 -0700
commit62dc8b5fbc7368c1bde0d29a00ddb204f6c9d1b6 (patch)
treed9f889ad727d222ccb1934dc5f713886ecb87b1c
parent0330344e0f63415421aff87d29ee037d3ea3b436 (diff)
parent7e71542e8b79ddd5164bf3ac5f11cae3b7d006ab (diff)
downloadgit-62dc8b5fbc7368c1bde0d29a00ddb204f6c9d1b6.tar.gz
Merge branch 'jk/sha1dc'
sha1dc/sha1.c wanted to check the endianness of the target platform at compilation time and used a CPP macro with a rather overly generic name, "BIGENDIAN", to pass the result of the check around in the file. It wasn't prepared for the same macro set to 0 (false) by the platform to signal that the target is _not_ a big endian box, and assumed that the endianness detection logic it has alone would be the one that is setting the macro, resulting in a breakage on Windows. This has been fixed by using a bit less generic name for the same purpose. * jk/sha1dc: sha1dc: avoid CPP macro collisions
-rw-r--r--sha1dc/sha1.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c
index 6dd0da3608..35e9dd5bf4 100644
--- a/sha1dc/sha1.c
+++ b/sha1dc/sha1.c
@@ -12,7 +12,7 @@
/*
Because Little-Endian architectures are most common,
- we only set BIGENDIAN if one of these conditions is met.
+ we only set SHA1DC_BIGENDIAN if one of these conditions is met.
Note that all MSFT platforms are little endian,
so none of these will be defined under the MSC compiler.
If you are compiling on a big endian platform and your compiler does not define one of these,
@@ -23,8 +23,9 @@
defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
-#define BIGENDIAN (1)
-
+#define SHA1DC_BIGENDIAN 1
+#else
+#undef SHA1DC_BIGENDIAN
#endif /*ENDIANNESS SELECTION*/
#define rotate_right(x,n) (((x)>>(n))|((x)<<(32-(n))))
@@ -35,11 +36,11 @@
#define sha1_mix(W, t) (rotate_left(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1))
-#if defined(BIGENDIAN)
+#if defined(SHA1DC_BIGENDIAN)
#define sha1_load(m, t, temp) { temp = m[t]; }
#else
#define sha1_load(m, t, temp) { temp = m[t]; sha1_bswap32(temp); }
-#endif /*define(BIGENDIAN)*/
+#endif /* !defined(SHA1DC_BIGENDIAN) */
#define sha1_store(W, t, x) *(volatile uint32_t *)&W[t] = x