Bug 416508: Use Visual C++ intrinsic function _byteswap_ulong. r=nelson.
Modified files: sha512.c sha_fast.h git-svn-id: svn://10.0.0.236/trunk@245806 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
f7be884407
commit
234b6e7e8b
@ -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 <stdlib.h>
|
||||
#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
|
||||
|
||||
@ -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 <stdlib.h>
|
||||
#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 */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user