src/hash.cpp: endian compatibility
This commit is contained in:
parent
4414f5ffe1
commit
3ca5852dc2
1 changed files with 4 additions and 2 deletions
|
@ -3,8 +3,10 @@
|
|||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "hash.h"
|
||||
#include "crypto/common.h"
|
||||
#include "crypto/hmac_sha512.h"
|
||||
|
||||
|
||||
inline uint32_t ROTL32(uint32_t x, int8_t r)
|
||||
{
|
||||
return (x << r) | (x >> (32 - r));
|
||||
|
@ -23,10 +25,10 @@ unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char
|
|||
|
||||
//----------
|
||||
// body
|
||||
const uint32_t* blocks = (const uint32_t*)(&vDataToHash[0] + nblocks * 4);
|
||||
const uint8_t* blocks = &vDataToHash[0] + nblocks * 4;
|
||||
|
||||
for (int i = -nblocks; i; i++) {
|
||||
uint32_t k1 = blocks[i];
|
||||
uint32_t k1 = ReadLE32(blocks + i*4);
|
||||
|
||||
k1 *= c1;
|
||||
k1 = ROTL32(k1, 15);
|
||||
|
|
Loading…
Reference in a new issue