Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/support/MurmurHash3.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ FORCE_INLINE uint64_t fmix64 ( uint64_t k )

//-----------------------------------------------------------------------------

void MurmurHash3_x86_32 ( const void * key, int len,
void MurmurHash3_x86_32 ( const void * key, size_t len,
uint32_t seed, void * out )
{
const uint8_t * data = (const uint8_t*)key;
const int nblocks = len / 4;
const size_t nblocks = len / 4;

uint32_t h1 = seed;

Expand All @@ -74,7 +74,7 @@ void MurmurHash3_x86_32 ( const void * key, int len,

const uint8_t * tail = data + nblocks*4;

for(int i = -nblocks; i; i++)
for(size_t i = -nblocks; i; i++)
{
uint32_t k1 = jl_load_unaligned_i32(tail + sizeof(uint32_t)*i);

Expand Down Expand Up @@ -112,11 +112,11 @@ void MurmurHash3_x86_32 ( const void * key, int len,

//-----------------------------------------------------------------------------

void MurmurHash3_x86_128 ( const void * key, const int len,
void MurmurHash3_x86_128 ( const void * key, const size_t len,
uint32_t seed, void * out )
{
const uint8_t * data = (const uint8_t*)key;
const int nblocks = len / 16;
const size_t nblocks = len / 16;

uint32_t h1 = seed;
uint32_t h2 = seed;
Expand All @@ -133,7 +133,7 @@ void MurmurHash3_x86_128 ( const void * key, const int len,

const uint8_t *tail = data + nblocks*16;

for(int i = -nblocks; i; i++)
for(size_t i = -nblocks; i; i++)
{
uint32_t k1 = jl_load_unaligned_i32(tail + sizeof(uint32_t)*(i*4 + 0));
uint32_t k2 = jl_load_unaligned_i32(tail + sizeof(uint32_t)*(i*4 + 1));
Expand Down Expand Up @@ -218,11 +218,11 @@ void MurmurHash3_x86_128 ( const void * key, const int len,

//-----------------------------------------------------------------------------

void MurmurHash3_x64_128 ( const void * key, const int len,
void MurmurHash3_x64_128 ( const void * key, const size_t len,
const uint32_t seed, void * out )
{
const uint8_t * data = (const uint8_t*)key;
const int nblocks = len / 16;
const size_t nblocks = len / 16;

uint64_t h1 = seed;
uint64_t h2 = seed;
Expand All @@ -233,7 +233,7 @@ void MurmurHash3_x64_128 ( const void * key, const int len,
//----------
// body

for(int i = 0; i < nblocks; i++)
for(size_t i = 0; i < nblocks; i++)
{
uint64_t k1 = jl_load_unaligned_i64(data + sizeof(uint64_t)*(i*2 + 0));
uint64_t k2 = jl_load_unaligned_i64(data + sizeof(uint64_t)*(i*2 + 1));
Expand Down
8 changes: 4 additions & 4 deletions src/support/MurmurHash3.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
//-----------------------------------------------------------------------------
// Platform-specific functions and macros
#include <stdint.h>

#include <stddef.h>
//-----------------------------------------------------------------------------

void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out );
void MurmurHash3_x86_32 ( const void * key, size_t len, uint32_t seed, void * out );

void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out );
void MurmurHash3_x86_128 ( const void * key, size_t len, uint32_t seed, void * out );

void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out );
void MurmurHash3_x64_128 ( const void * key, size_t len, uint32_t seed, void * out );

//-----------------------------------------------------------------------------

Expand Down
8 changes: 8 additions & 0 deletions test/hashing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,11 @@ end
end
end
end

if Sys.WORD_SIZE >= 64
@testset "very large string" begin
N = 2^31+1
s = String('\0'^N);
objectid(s)
end
end