# CRC32C
[![Build Status](https://travis-ci.org/google/crc32c.svg?branch=master)](https://travis-ci.org/google/crc32c)
[![Build Status](https://ci.appveyor.com/api/projects/status/moiq7331pett4xuj/branch/master?svg=true)](https://ci.appveyor.com/project/pwnall/crc32c)
New file format authors should consider
[HighwayHash](https://github.com/google/highwayhash). The initial version of
this code was extracted from [LevelDB](https://github.com/google/leveldb), which
is a stable key-value store that is widely used at Google.
This project collects a few CRC32C implementations under an umbrella that
dispatches to a suitable implementation based on the host computer's hardware
capabilities.
CRC32C is specified as the CRC that uses the iSCSI polynomial in
[RFC 3720](https://tools.ietf.org/html/rfc3720#section-12.1). The polynomial was
introduced by G. Castagnoli, S. Braeuer and M. Herrmann. CRC32C is used in
software such as Btrfs, ext4, Ceph and leveldb.
## Usage
```cpp
#include "crc32c/crc32c.h"
int main() {
const std::uint8_t buffer[] = {0, 0, 0, 0};
std::uint32_t result;
// Process a raw buffer.
result = crc32c::Crc32c(buffer, 4);
// Process a std::string.
std::string string;
string.resize(4);
result = crc32c::Crc32c(string);
// If you have C++17 support, process a std::string_view.
std::string_view string_view(string);
result = crc32c::Crc32c(string_view);
return 0;
}
```
## Prerequisites
This project uses [CMake](https://cmake.org/) for building and testing. CMake is
available in all popular Linux distributions, as well as in
[Homebrew](https://brew.sh/).
This project uses submodules for dependency management.
```bash
git submodule update --init --recursive
```
If you're using [Atom](https://atom.io/), the following packages can help.
```bash
apm install autocomplete-clang build build-cmake clang-format language-cmake \
linter linter-clang
```
If you don't mind more setup in return for more speed, replace
`autocomplete-clang` and `linter-clang` with `you-complete-me`. This requires
[setting up ycmd](https://github.com/Valloric/ycmd#building).
```bash
apm install autocomplete-plus build build-cmake clang-format language-cmake \
linter you-complete-me
```
## Building
The following commands build and install the project.
```bash
mkdir build
cd build
cmake -DCRC32C_BUILD_TESTS=0 -DCRC32C_BUILD_BENCHMARKS=0 .. && make all install
```
## Development
The following command (when executed from `build/`) (re)builds the project and
runs the tests.
```bash
cmake .. && cmake --build . && ctest --output-on-failure
```
### Android testing
The following command builds the project against the Android NDK, which is
useful for benchmarking against ARM processors.
```bash
cmake .. -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DCMAKE_ANDROID_NDK=$HOME/Library/Android/sdk/ndk-bundle \
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DCMAKE_ANDROID_STL_TYPE=c++_static -DCRC32C_USE_GLOG=0 \
-DCMAKE_BUILD_TYPE=Release && cmake --build .
```
The following commands install and run the benchmarks.
```bash
adb push crc32c_bench /data/local/tmp
adb shell chmod +x /data/local/tmp/crc32c_bench
adb shell 'cd /data/local/tmp && ./crc32c_bench'
adb shell rm /data/local/tmp/crc32c_bench
```
The following commands install and run the tests.
```bash
adb push crc32c_tests /data/local/tmp
adb shell chmod +x /data/local/tmp/crc32c_tests
adb shell 'cd /data/local/tmp && ./crc32c_tests'
adb shell rm /data/local/tmp/crc32c_tests
```
没有合适的资源?快使用搜索试试~ 我知道了~
crc32c:CRC32C实现,支持特定于CPU的加速指令
共38个文件
cc:13个
h:10个
yml:2个
需积分: 50 5 下载量 80 浏览量
2021-05-22
17:42:45
上传
评论
收藏 44KB ZIP 举报
温馨提示
CRC32C 新的文件格式作者应考虑 。 该代码的初始版本是从中提取的, 是稳定的键值存储,已在Google上广泛使用。 该项目在一个伞下收集了一些CRC32C实现,并根据主机的硬件功能将其分发给合适的实现。 CRC32C被指定为使用的iSCSI多项式的CRC。 多项式由G. Castagnoli,S。Braeuer和M.Herrmann引入。 CRC32C用于Btrfs,ext4,Ceph和leveldb等软件中。 用法 # include " crc32c/crc32c.h " int main () { const std:: uint8_t buffer[] = { 0 , 0 , 0 , 0 }; std:: uint32_t result; // Process a raw buffer. result = crc32c::Crc32c (buffer,
资源详情
资源评论
资源推荐
收起资源包目录
crc32c-master.zip (38个子文件)
crc32c-master
AUTHORS 439B
.gitmodules 327B
src
crc32c_prefetch.h 1KB
crc32c_prefetch_unittest.cc 419B
crc32c_portable_unittest.cc 584B
crc32c_read_le.h 2KB
crc32c_extend_unittests.h 4KB
crc32c_benchmark.cc 3KB
crc32c_arm64_check.h 2KB
crc32c_read_le_unittest.cc 963B
crc32c_round_up_unittest.cc 3KB
crc32c_portable.cc 19KB
crc32c.cc 1KB
crc32c_sse42_check.h 1KB
crc32c_internal.h 735B
crc32c_test_main.cc 579B
crc32c_sse42_unittest.cc 696B
crc32c_round_up.h 1KB
crc32c_config.h.in 1KB
crc32c_sse42.h 1KB
crc32c_unittest.cc 4KB
crc32c_capi_unittest.c 2KB
crc32c_sse42.cc 10KB
crc32c_arm64_unittest.cc 622B
crc32c_arm64.h 568B
crc32c_arm64.cc 3KB
.clang-format 45B
CMakeLists.txt 14KB
CONTRIBUTING.md 969B
.travis.yml 2KB
Crc32cConfig.cmake.in 317B
LICENSE 1KB
README.md 3KB
.appveyor.yml 1KB
.ycm_extra_conf.py 4KB
.gitignore 68B
third_party
benchmark
googletest
glog
.clang_complete 212B
include
crc32c
crc32c.h 2KB
共 38 条
- 1
机器好奇心
- 粉丝: 26
- 资源: 4598
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0