Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in HasKeyBag on SPARC Solaris 11 #2196

Merged
merged 3 commits into from
Feb 20, 2018
Merged
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
10 changes: 9 additions & 1 deletion src/intfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,18 @@ static inline uint64_t rotl64 ( uint64_t x, int8_t r )
//-----------------------------------------------------------------------------
// Block read - if your platform needs to do endian-swapping or can only
// handle aligned reads, do the conversion here
//
// The pointer p may not be aligned, which means that directly reading it can
// incur a major performance penalty or even trigger a segfault on certain
// architectures (e.g. ARM, SPARC). Thus we use memcpy here, with the implicit
// hope that on archs which don't need this, the compiler will optimize it back
// into a direct copy (verified to happen with GCC and clang on x86_64)

FORCE_INLINE uint64_t getblock8 ( const uint64_t * p, int i )
{
return p[i];
uint64_t val;
memcpy(&val, p + i, sizeof(uint64_t));
return val;
}

//-----------------------------------------------------------------------------
Expand Down