Skip to content

Commit 7bbbd83

Browse files
PureWhiteWujoshlftkaitchuck
authored
fix: tkaitchuck#170 compile fail on aarch64 (tkaitchuck#171)
compile fail on aarch64 Co-authored-by: Joshua Liebow-Feeser <joshlf@users.noreply.github.com> Co-authored-by: Joshua Liebow-Feeser <joshlf@users.noreply.github.com> Co-authored-by: Tom Kaitchuck <tkaitchuck@users.noreply.github.com>
1 parent a57f243 commit 7bbbd83

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

.github/workflows/rust.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
env:
5252
RUSTFLAGS: -C target-cpu=native
5353
steps:
54-
- uses: actions/checkout@v2
54+
- uses: actions/checkout@v2
5555
- name: Install latest nightly
5656
uses: actions-rs/toolchain@v1
5757
with:
@@ -89,6 +89,19 @@ jobs:
8989
with:
9090
command: check
9191
args: --target armv7-unknown-linux-gnueabihf
92+
aarch64-apple-darwin:
93+
name: Aarch64 Apple Darwin
94+
runs-on: macos-latest
95+
steps:
96+
- uses: actions/checkout@v2
97+
- uses: actions-rs/toolchain@v1
98+
with:
99+
toolchain: stable
100+
target: aarch64-apple-darwin
101+
- uses: actions-rs/cargo@v1
102+
with:
103+
command: check
104+
args: --target aarch64-apple-darwin
92105
i686-unknown-linux-gnu:
93106
name: Linux i686
94107
runs-on: ubuntu-latest

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ahash"
3-
version = "0.8.4"
3+
version = "0.8.5"
44
authors = ["Tom Kaitchuck <Tom.Kaitchuck@gmail.com>"]
55
license = "MIT OR Apache-2.0"
66
description = "A non-cryptographic hash function using AES-NI for high performance"

src/operations.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,9 @@ pub(crate) fn aesenc(value: u128, xor: u128) -> u128 {
123123
use core::arch::aarch64::*;
124124
#[cfg(target_arch = "arm")]
125125
use core::arch::arm::*;
126-
unsafe {
127-
let value = transmute!(value);
128-
xor ^ transmute::<_, u128>(vaesmcq_u8(vaeseq_u8(value, transmute!(0u128))))
129-
}
126+
let res = unsafe { vaesmcq_u8(vaeseq_u8(transmute!(value), transmute!(0u128))) };
127+
let value: u128 = transmute!(res);
128+
xor ^ value
130129
}
131130

132131
#[cfg(all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)))]
@@ -156,10 +155,9 @@ pub(crate) fn aesdec(value: u128, xor: u128) -> u128 {
156155
use core::arch::aarch64::*;
157156
#[cfg(target_arch = "arm")]
158157
use core::arch::arm::*;
159-
unsafe {
160-
let value = transmute!(value);
161-
xor ^ transmute::<_, u128>(vaesimcq_u8(vaesdq_u8(value, transmute!(0u128))))
162-
}
158+
let res = unsafe { vaesimcq_u8(vaesdq_u8(transmute!(value), transmute!(0u128))) };
159+
let value: u128 = transmute!(res);
160+
xor ^ value
163161
}
164162

165163
#[allow(unused)]

0 commit comments

Comments
 (0)