Skip to content

Commit ad6287a

Browse files
committed
Fixes for const generics used in sm4ks and sm4ed
Use `static_assert!` macro to constrain BS: u8 Thanks @Amanieu
1 parent 596762d commit ad6287a

File tree

1 file changed

+2
-2
lines changed
  • crates/core_arch/src/riscv_shared

1 file changed

+2
-2
lines changed

crates/core_arch/src/riscv_shared/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ pub fn sm3p1(x: u32) -> u32 {
685685
/// According to RISC-V Cryptography Extensions, Volume I, the execution latency of
686686
/// this instruction must always be independent from the data it operates on.
687687
pub fn sm4ed<const BS: u8>(x: u32, a: u32) -> u32 {
688-
static_assert_imm2!(BS); // `bs` immediate value must be within [0, 3]
688+
static_assert!(BS: u8 where BS <= 3);
689689
let ans: u32;
690690
match BS {
691691
0 => unsafe {
@@ -750,7 +750,7 @@ pub fn sm4ed<const BS: u8>(x: u32, a: u32) -> u32 {
750750
/// According to RISC-V Cryptography Extensions, Volume I, the execution latency of
751751
/// this instruction must always be independent from the data it operates on.
752752
pub fn sm4ks<const BS: u8>(x: u32, k: u32) -> u32 {
753-
static_assert_imm2!(BS); // `bs` immediate value must be within [0, 3]
753+
static_assert!(BS: u8 where BS <= 3);
754754
let ans: u32;
755755
match BS {
756756
0 => unsafe {

0 commit comments

Comments
 (0)