diff --git a/mozilla/security/nss/lib/freebl/sha512.c b/mozilla/security/nss/lib/freebl/sha512.c index a42c75ae8c5..999e5fa5d1e 100644 --- a/mozilla/security/nss/lib/freebl/sha512.c +++ b/mozilla/security/nss/lib/freebl/sha512.c @@ -36,7 +36,7 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -/* $Id: sha512.c,v 1.10 2008-02-14 18:41:37 wtc%google.com Exp $ */ +/* $Id: sha512.c,v 1.11 2008-02-16 02:24:48 wtc%google.com Exp $ */ #include "prcpucfg.h" #if defined(_X86_) || defined(SHA_NO_LONG_LONG) #define NOUNROLL512 1 @@ -93,7 +93,12 @@ static const PRUint32 H256[8] = { 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; -#if defined(_MSC_VER) && defined(_X86_) +#if (_MSC_VER >= 1300) +#include +#pragma intrinsic(_byteswap_ulong) +#define SHA_HTONL(x) _byteswap_ulong(x) +#define BYTESWAP4(x) x = SHA_HTONL(x) +#elif defined(_MSC_VER) && defined(_X86_) #ifndef FORCEINLINE #if (_MSC_VER >= 1200) #define FORCEINLINE __forceinline diff --git a/mozilla/security/nss/lib/freebl/sha_fast.h b/mozilla/security/nss/lib/freebl/sha_fast.h index 6243471b025..cde706610bf 100644 --- a/mozilla/security/nss/lib/freebl/sha_fast.h +++ b/mozilla/security/nss/lib/freebl/sha_fast.h @@ -57,8 +57,12 @@ struct SHA1ContextStr { SHA_HW_t H[22]; /* 5 state variables, 16 tmp values, 1 extra */ }; -#if defined(_MSC_VER) && defined(_X86_) -#if defined(IS_LITTLE_ENDIAN) +#if defined(_MSC_VER) +#include +#if (_MSC_VER >= 1300) +#pragma intrinsic(_byteswap_ulong) +#define SHA_HTONL(x) _byteswap_ulong(x) +#elif defined(_X86_) #ifndef FORCEINLINE #if (_MSC_VER >= 1200) #define FORCEINLINE __forceinline @@ -78,12 +82,12 @@ swap4b(PRUint32 dwd) } #define SHA_HTONL(x) swap4b(x) -#endif /* IS_LITTLE_ENDIAN */ +#endif /* _X86_ */ #pragma intrinsic (_lrotr, _lrotl) #define SHA_ROTL(x,n) _lrotl(x,n) #define SHA_ROTL_IS_DEFINED 1 -#endif /* _MSC_VER && _X86_ */ +#endif /* _MSC_VER */ #if defined(__GNUC__) /* __x86_64__ and __x86_64 are defined by GCC on x86_64 CPUs */