diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1031050..46d42e4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -12,32 +12,47 @@ env: jobs: # Ensure the crate builds - build: - + build_x86_64: runs-on: ubuntu-latest strategy: matrix: rust: [1.56.0, stable, nightly] - features: ["+avx2", "+sse2", "-avx2,-sse2"] + features: ["+avx2", "+sse2"] env: - RUSTCFLAGS: "-C target-features={{matrix.features}}" + RUSTFLAGS: "-C target-feature=${{matrix.features}}" steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: + target: x86_64-unknown-linux-gnu profile: minimal toolchain: ${{ matrix.rust }} override: true - - name: Tests + - name: Tests (x86_64) run: | cargo test -v --no-default-features --tests --lib && cargo build --verbose --features "$FEATURES" && cargo test --verbose --features "$FEATURES" && cargo test --verbose --release --features "$FEATURES" + build_aarch64: + runs-on: ubuntu-latest + strategy: + matrix: + rust: [1.56.0, stable, nightly] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + target: aarch64-unknown-linux-gnu + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + - name: Tests (aarch64) + run: cargo check --target aarch64-unknown-linux-gnu + # Use clippy to lint for code smells clippy: - runs-on: ubuntu-latest strategy: matrix: @@ -58,13 +73,11 @@ jobs: # Enforce rustfmt formatting formatting: - runs-on: ubuntu-latest strategy: matrix: # Run formatting checks only on stable rust: [stable] - steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -79,13 +92,11 @@ jobs: # Ensure the benchmarks compile benchmark_compiles: - runs-on: ubuntu-latest strategy: matrix: # Check builds only on stable rust: [stable] - steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -102,7 +113,6 @@ jobs: build-wasm: runs-on: ubuntu-latest timeout-minutes: 30 - needs: build steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable diff --git a/src/block/default.rs b/src/block/default.rs index 48d52f9..c71493e 100644 --- a/src/block/default.rs +++ b/src/block/default.rs @@ -11,6 +11,16 @@ impl Block { pub const ALL: Self = Block(!0); pub const BITS: usize = core::mem::size_of::() * 8; + #[inline] + pub fn into_usize_array(self) -> [usize; Self::USIZE_COUNT] { + [self.0] + } + + #[inline] + pub const fn from_usize_array(array: [usize; Self::USIZE_COUNT]) -> Self { + Self(array[0]) + } + #[inline] pub const fn is_empty(self) -> bool { self.0 == Self::NONE.0