Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't use 32-bit unaligned reads in SipHash implementation
This fixes a bug on CentOS 6 and possibly is a bug in glibc 2.12.1 or the toolchain which has issues with unaligned 32-bit reads. Instead of trying to do a 32-bit unaligned read, only do 8-bit reads. This should optimize to a single operation in the compiler, and even if it does not, we only called siphashfinish or siphashfinish_32bits once for every string we hash. Fixes issue #910
- Loading branch information
Showing
2 changed files
with
16 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
|
||
all: | ||
gcc -O3 test.c -g -Wall -Wextra -ggdb -o siphashtest -D MVM_CAN_UNALIGNED_INT64 && ./siphashtest | ||
gcc -O3 test.c -g -Wall -Wextra -ggdb -o siphashtest && ./siphashtest | ||
echo "Testing unaligned reads" && gcc -O3 test.c -g -Wall -Wextra -ggdb -o siphashtest-unaligned -D MVM_CAN_UNALIGNED_INT64 -D MVM_CAN_UNALIGNED_INT32 | ||
echo "Testing only aligned reads" && gcc -O3 test.c -g -Wall -Wextra -ggdb -o siphashtest-aligned | ||
test: | ||
./siphashtest-unaligned | ||
./siphashtest-aligned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters