Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/precheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,25 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake cpplint
sudo apt-get install -y \
build-essential \
cmake \
cpplint \
clang-tidy \
clang-format \
libcurl4-openssl-dev \
libfftw3-dev

- name: Check cpplint
run: cpplint --recursive lib include
run: cpplint $(git ls-files '*.cpp' '*.h')

- name: Check clang-tidy
run: |
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
clang-tidy -p build/compile_commands.json $(git ls-files '*.cpp' '*.h' | grep -v 'wasm.cpp')

# TODO(BayernMuller): Add clang-format check
# - name: Check clang-format
# run: |
# clang-format --dry-run --Werror $(git ls-files '*.cpp' '*.h')

13 changes: 8 additions & 5 deletions lib/utils/crc32.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
#ifndef LIB_UTILS_CRC32_H_
#define LIB_UTILS_CRC32_H_

#include <cstddef>
#include <cstdint>

namespace crc32
{
std::uint32_t crc32(const char *buf, std::size_t len)
{
std::uint32_t crc_table[256];
std::uint32_t crc;
std::size_t i, j;

for (i = 0; i < 256; i++)
for (std::size_t i = 0; i < 256; i++)
{
crc = i;
for (j = 0; j < 8; j++)
for (std::size_t j = 0; j < 8; j++)
crc = crc & 1 ? (crc >> 1) ^ 0xEDB88320UL : crc >> 1;
crc_table[i] = crc;
};
}
crc = 0xFFFFFFFFUL;

while (len--)
{
crc = crc_table[(crc ^ *buf++) & 0xFF] ^ (crc >> 8);

}
return crc ^ 0xFFFFFFFFUL;
}
} // namespace crc32
Expand Down
Loading