htot / crc32c Goto Github PK
View Code? Open in Web Editor NEWFastest crc32c algorithms for i686 and x86_64 including benchmarks
Fastest crc32c algorithms for i686 and x86_64 including benchmarks
you've got no .gitmodules file, and yet there's a gitlink for crc32c/crc32c/crc32c, which is fragile for anyone who might want to submodule in your lovely implementation...
Although the crc32c results I'm seeing are consistent with the tests in this library, they do not agree with the crc32 results of other libraries, such as zlib:
#include <crc32c/crc32c.h>
#include <zlib.h>
unsigned long crc_zlib = crc32(0L, Z_NULL, 0);
std::string test_string = "hello-world";
uint32_t truth = 2983461467;
const auto test_string_chars = reinterpret_cast<const unsigned char*>(test_string.c_str());
crc_zlib = crc32(crc_zlib, (const unsigned char*)test_string_chars, test_string.length()); // this is zlib
uint32_t crc_c = crc32c::Crc32c(test_string); //
std::cout << "truth: " << truth << ", zlib: " << crc_zlib << ", crc32c: " << crc_c << std::endl;
produces the output:
truth: 2983461467, zlib: 2983461467, crc32c: 4099351003
Calling the same with test_string = "The quick brown fox jumps over the lazy dog"
produces the output:
truth: 576848900, zlib: 1095738169, crc32c: 576848900
You can see the short phrase "The quick brown fox..." produces the same crc as in your tests, but it does not agree with zlib. The zlib result on "hello-world" agrees with all of the sources listed here.
I thought perhaps there was a difference in what was being calculated, such as returning the signed 32-bit crc rather than unsigned, but it is indeed returning a unit32_t
, so that wouldn't explain it.
This is a Google Cloud Compute instance with haswell Intel architecture. When I build the project, running ./crc32c_test
shows all tests PASSED.
Do you have any guidance on what the discrepancy may be? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.