Skip to content

Commit

Permalink
Fix non-x86(_64) builds (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
james7132 authored Mar 19, 2024
1 parent ecf08dd commit 9fdf89f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/block/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ impl Block {
pub const ALL: Self = Block(!0);
pub const BITS: usize = core::mem::size_of::<Self>() * 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
Expand Down

0 comments on commit 9fdf89f

Please sign in to comment.