SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Checksum.cc
Go to the documentation of this file.
1 /*
2  * SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3  * License details at <https://github.com/kashirin-alex/swc-db/#license>
4  */
5 
6 
7 #include "swcdb/core/Checksum.h"
8 #include "swcdb/core/Logger.h"
9 
10 namespace SWC { namespace Core {
11 
12 
13 
14 bool checksum_i32_log_chk(uint32_t checksum, const uint8_t* base,
15  uint32_t len) {
16  uint32_t computed = checksum32(base, len);
17  if(checksum == computed)
18  return true;
20  "checksum32, original(%u) != computed(%u)",
21  checksum, computed);
22  return false;
23 }
24 
25 
26 
27 }} // namespace SWC::Core
Logger.h
checksum
uint32_t checksum
Header checksum (excl. it self)
Definition: Header.h:59
SWC_LOGF
#define SWC_LOGF(priority, fmt,...)
Definition: Logger.h:188
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Core::checksum_i32_log_chk
bool checksum_i32_log_chk(uint32_t checksum, const uint8_t *base, uint32_t len)
Definition: Checksum.cc:14
SWC::Core::checksum32
uint32_t checksum32(const uint8_t *data8, size_t len8) noexcept SWC_ATTRIBS((SWC_ATTRIB_O3))
Definition: Checksum.h:55
SWC::LOG_ERROR
@ LOG_ERROR
Definition: Logger.h:32
Checksum.h