RedSpah / xxhash_cpp

Port of the xxhash library to C++17.
BSD 2-Clause "Simplified" License
162 stars 31 forks source link

C++14 compatibility? #5

Closed Flamefire closed 5 years ago

Flamefire commented 5 years ago

I'm on a project with C++14 requirement. Is it possible to adjust the implementation to be C++14 compatible?

From what I have seen only if constexpr is used from C++17. In once case (swap32/64) it can be replaced by a simple overload instead of 2 names and the other can be solved by extracting a subfunction (potentially merging code from here and (here)[https://github.com/RedSpah/xxhash_cpp/blob/92cf55f21d341520137e4a7eb155290d390bdbff/xxhash/xxhash.hpp#L589] although I'm not sure)

This would make it available to a wider audience especially as this seems the only C++ implementation. Thanks for that! :+1:

RedSpah commented 5 years ago

Done. Rewrote the problematic functions to be C++14 compliant. Will see about adding XXH3 support later on today or tomorrow.

Flamefire commented 5 years ago

Thank you very much!

I tested it locally and it compiles with C++14. C++11 does not work due to missing _t template aliases like decay_t.

Personally I don't think going for C++11 is worth it as most compilers supporting C++11 also support C++14. So just advertise it as C++14 compatible and have the reference updated. :) (https://cyan4973.github.io/xxHash/#other-languages)