Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: magiclen/crc-any
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.3.5
Choose a base ref
...
head repository: magiclen/crc-any
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.4.3
Choose a head ref
  • 20 commits
  • 18 files changed
  • 3 contributors

Commits on Jul 29, 2020

  1. update Cargo.toml

    magiclen committed Jul 29, 2020
    Copy the full SHA
    bd372ee View commit details

Commits on Nov 29, 2020

  1. Copy the full SHA
    f4e22f3 View commit details
  2. Copy the full SHA
    1cc5bb8 View commit details

Commits on Apr 21, 2021

  1. switch to GitHub Actions

    magiclen committed Apr 21, 2021
    Copy the full SHA
    3ed15f4 View commit details
  2. run clippy

    magiclen committed Apr 21, 2021
    Copy the full SHA
    41ffd10 View commit details
  3. Merge pull request #6 from AlyoshaVasilieva/check

    Fix CRC8 DARC and CRC32 JAMCRC docs
    magiclen authored Apr 21, 2021
    Copy the full SHA
    d22b358 View commit details
  4. fix tests

    magiclen committed Apr 21, 2021
    Copy the full SHA
    aae8e0a View commit details
  5. run clippy

    magiclen committed Apr 21, 2021
    Copy the full SHA
    98a78ec View commit details

Commits on Apr 22, 2021

  1. remove .travis.yml

    magiclen committed Apr 22, 2021
    Copy the full SHA
    981fa50 View commit details

Commits on Jun 2, 2021

  1. fix doc

    magiclen committed Jun 2, 2021
    Copy the full SHA
    2d6608f View commit details
  2. update README.md

    magiclen committed Jun 2, 2021
    Copy the full SHA
    78da6a3 View commit details

Commits on Jun 13, 2021

  1. run clippy

    magiclen committed Jun 13, 2021
    Copy the full SHA
    f6e1468 View commit details

Commits on Sep 18, 2021

  1. update dependencies

    magiclen committed Sep 18, 2021
    Copy the full SHA
    37fd83a View commit details

Commits on Oct 18, 2021

  1. Improve crc creation performance

    This remove unnecessary copy for statically known crc table
    
    Fix #7
    a1ien committed Oct 18, 2021
    Copy the full SHA
    a35c4b6 View commit details

Commits on Oct 23, 2021

  1. Copy the full SHA
    2a1f03c View commit details
  2. run rustfmt

    magiclen committed Oct 23, 2021
    Copy the full SHA
    b373b59 View commit details
  3. bump version

    magiclen committed Oct 23, 2021
    Copy the full SHA
    5eabe3d View commit details

Commits on Mar 5, 2022

  1. update project

    magiclen committed Mar 5, 2022
    Copy the full SHA
    1284869 View commit details

Commits on May 20, 2022

  1. fix doc

    magiclen committed May 20, 2022
    Copy the full SHA
    6b97212 View commit details
  2. fix doc

    magiclen committed May 20, 2022
    Copy the full SHA
    db46f6b View commit details
Showing with 517 additions and 583 deletions.
  1. +43 −0 .github/workflows/ci-version.yml
  2. +64 −0 .github/workflows/ci.yml
  3. +0 −67 .travis.yml
  4. +4 −8 Cargo.toml
  5. +2 −5 README.md
  6. +49 −7 benches/bench.rs
  7. +0 −10 src/constants/crc_u16.rs
  8. +0 −10 src/constants/crc_u32.rs
  9. +0 −4 src/constants/crc_u64.rs
  10. +0 −8 src/constants/crc_u8.rs
  11. +80 −106 src/crc_u16.rs
  12. +62 −74 src/crc_u32.rs
  13. +32 −28 src/crc_u64.rs
  14. +55 −67 src/crc_u8.rs
  15. +110 −185 src/lib.rs
  16. +16 −0 src/lookup_table.rs
  17. +0 −2 tests/alloc.rs
  18. +0 −2 tests/heapless.rs
43 changes: 43 additions & 0 deletions .github/workflows/ci-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI-version

on:
push:
tags:
- "v*"

env:
CARGO_TERM_COLOR: always

jobs:
tests:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
toolchain:
- stable
- nightly
name: Test ${{ matrix.toolchain }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- run: cargo build --release
- run: cargo test --release
- run: cargo doc --release
- run: cargo build --release --features heapless
- run: cargo test --release --features heapless
- run: cargo doc --release --features heapless
- run: cargo build --release --no-default-features
- run: cargo test --release --no-default-features
- run: cargo doc --release --no-default-features
- run: cargo build --release --no-default-features --features heapless
- run: cargo test --release --no-default-features --features heapless
- run: cargo doc --release --no-default-features --features heapless
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- run: cargo fmt -- --check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: clippy
- run: cargo clippy --all-targets --all-features -- -D warnings

tests:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
toolchain:
- stable
- nightly
name: Test ${{ matrix.toolchain }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- run: cargo build
- run: cargo test
- run: cargo doc
- run: cargo build --features heapless
- run: cargo test --features heapless
- run: cargo doc --features heapless
- run: cargo build --no-default-features
- run: cargo test --no-default-features
- run: cargo doc --no-default-features
- run: cargo build --no-default-features --features heapless
- run: cargo test --no-default-features --features heapless
- run: cargo doc --no-default-features --features heapless
67 changes: 0 additions & 67 deletions .travis.yml

This file was deleted.

12 changes: 4 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
[package]
name = "crc-any"
version = "2.3.5"
version = "2.4.3"
authors = ["Magic Len <len@magiclen.org>"]
edition = "2018"
edition = "2021"
repository = "https://github.com/magiclen/crc-any"
homepage = "https://magiclen.org/crc-any"
keywords = ["hash", "crc", "crc16", "crc32", "crc64"]
categories = ["no-std", "algorithms"]
description= "To compute CRC values by providing the length of bits, expression, reflection, an initial value and a final xor value. It has many built-in CRC functions."
description = "To compute CRC values by providing the length of bits, expression, reflection, an initial value and a final xor value. It has many built-in CRC functions."
readme = "README.md"
license = "MIT"
include = ["src/**/*", "Cargo.toml", "README.md", "LICENSE", "benches/bench.rs"]

[badges.travis-ci]
repository = "magiclen/crc-any"
branch = "master"

[dependencies]

[dependencies.debug-helper]
version = "0.3"
optional = true

[dependencies.heapless]
version = "0.5"
version = "0.7"
optional = true

[dev-dependencies]
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CRC Any
====================

[![Build Status](https://travis-ci.org/magiclen/crc-any.svg?branch=master)](https://travis-ci.org/magiclen/crc-any)
[![CI](https://github.com/magiclen/crc-any/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/crc-any/actions/workflows/ci.yml)

To compute CRC values by providing the length of bits, expression, reflection, an initial value and a final xor value. It has many built-in CRC functions.

@@ -10,8 +10,6 @@ To compute CRC values by providing the length of bits, expression, reflection, a
You can use `create_crc` associated function to create a CRC instance by providing the length of bits, expression, reflection, an initial value and a final xor value. For example, if you want to compute a CRC-24 value.

```rust
extern crate crc_any;

use crc_any::CRC;

let mut crc24 = CRC::create_crc(0x0000000000864CFB, 24, 0x0000000000B704CE, 0x0000000000000000, false);
@@ -62,6 +60,7 @@ To simplify the usage, there are several common versions of CRC whose computing
* crc16
* crc16ccitt_false
* crc16aug_ccitt
* crc16buypass
* crc16cdma2000
* crc16dds_110
* crc16dect_r
@@ -112,8 +111,6 @@ To simplify the usage, there are several common versions of CRC whose computing
For instance,

```rust
extern crate crc_any;

use crc_any::CRC;

let mut crc64 = CRC::crc64();
56 changes: 49 additions & 7 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
extern crate crc_any;

#[macro_use]
extern crate bencher;

use crc_any::CRC;

use bencher::Bencher;
use bencher::{benchmark_group, benchmark_main, Bencher};

fn crc8_construct(bencher: &mut Bencher) {
bencher.iter(|| CRC::create_crc(0x07, 8, 0x00, 0x00, false))
@@ -15,6 +10,7 @@ fn crc8_update_megabytes(bencher: &mut Bencher) {
let mut crc = CRC::crc8();
let mut bytes = Vec::with_capacity(1000000);

#[allow(clippy::uninit_vec)]
unsafe {
bytes.set_len(1000000);
}
@@ -34,6 +30,7 @@ fn crc12_update_megabytes(bencher: &mut Bencher) {
let mut crc = CRC::crc12();
let mut bytes = Vec::with_capacity(1000000);

#[allow(clippy::uninit_vec)]
unsafe {
bytes.set_len(1000000);
}
@@ -53,6 +50,27 @@ fn crc16_update_megabytes(bencher: &mut Bencher) {
let mut crc = CRC::crc16();
let mut bytes = Vec::with_capacity(1000000);

#[allow(clippy::uninit_vec)]
unsafe {
bytes.set_len(1000000);
}

bencher.iter(|| {
crc.digest(&bytes);

crc.get_crc()
})
}

fn crc16_construct_wellknown(bencher: &mut Bencher) {
bencher.iter(crc_any::CRCu16::crc16ccitt_false)
}

fn crc16_update_megabytes_wellknown(bencher: &mut Bencher) {
let mut crc = crc_any::CRCu16::crc16ccitt_false();
let mut bytes = Vec::with_capacity(1000000);

#[allow(clippy::uninit_vec)]
unsafe {
bytes.set_len(1000000);
}
@@ -72,6 +90,7 @@ fn crc32_update_megabytes(bencher: &mut Bencher) {
let mut crc = CRC::crc32();
let mut bytes = Vec::with_capacity(1000000);

#[allow(clippy::uninit_vec)]
unsafe {
bytes.set_len(1000000);
}
@@ -93,6 +112,27 @@ fn crc64_update_megabytes(bencher: &mut Bencher) {
let mut crc = CRC::crc64();
let mut bytes = Vec::with_capacity(1000000);

#[allow(clippy::uninit_vec)]
unsafe {
bytes.set_len(1000000);
}

bencher.iter(|| {
crc.digest(&bytes);

crc.get_crc()
})
}

fn crc64_construct_wellknown(bencher: &mut Bencher) {
bencher.iter(crc_any::CRCu64::crc64iso)
}

fn crc64_update_megabytes_wellknown(bencher: &mut Bencher) {
let mut crc = CRC::crc64();
let mut bytes = Vec::with_capacity(1000000);

#[allow(clippy::uninit_vec)]
unsafe {
bytes.set_len(1000000);
}
@@ -107,7 +147,9 @@ fn crc64_update_megabytes(bencher: &mut Bencher) {
benchmark_group!(crc8, crc8_construct, crc8_update_megabytes);
benchmark_group!(crc12, crc12_construct, crc12_update_megabytes);
benchmark_group!(crc16, crc16_construct, crc16_update_megabytes);
benchmark_group!(crc16_wellknown, crc16_construct_wellknown, crc16_update_megabytes_wellknown);
benchmark_group!(crc32, crc32_construct, crc32_update_megabytes);
benchmark_group!(crc64, crc64_construct, crc64_update_megabytes);
benchmark_group!(crc64_wellknown, crc64_construct_wellknown, crc64_update_megabytes_wellknown);

benchmark_main!(crc8, crc12, crc16, crc32, crc64);
benchmark_main!(crc8, crc12, crc16, crc16_wellknown, crc32, crc64, crc64_wellknown);
Loading