utils: Put crc32 under utils namespace

It conflicts with crc in zlib
Message-Id: <1480918984-4117-2-git-send-email-asias@scylladb.com>
This commit is contained in:
Asias He
2016-12-05 06:23:04 +00:00
committed by Pekka Enberg
parent 54ea0055fc
commit 00d7a35949
3 changed files with 8 additions and 4 deletions

View File

@@ -83,7 +83,7 @@ static logging::logger logger("commitlog");
using namespace std::chrono_literals;
class crc32_nbo {
crc32 _c;
utils::crc32 _c;
public:
template <typename T>
void process(T t) {

View File

@@ -32,14 +32,14 @@ thread_local disk_error_signal_type general_disk_error;
inline
uint32_t
do_compute_crc(crc32& c) {
do_compute_crc(utils::crc32& c) {
return c.get();
}
template <typename T, typename... Rest>
inline
uint32_t
do_compute_crc(crc32& c, const T& val, const Rest&... rest) {
do_compute_crc(utils::crc32& c, const T& val, const Rest&... rest) {
c.process(val);
return do_compute_crc(c, rest...);
}
@@ -48,7 +48,7 @@ template <typename... T>
inline
uint32_t
compute_crc(const T&... vals) {
crc32 c;
utils::crc32 c;
return do_compute_crc(c, vals...);
}

View File

@@ -24,6 +24,8 @@
#include <cstdint>
#include <smmintrin.h>
namespace utils {
class crc32 {
uint32_t _r = 0;
public:
@@ -95,3 +97,5 @@ public:
return _r;
}
};
}