Skip to content

Commit f61be77

Browse files
committed
Small fix for const generics used in sm4ks and sm4ed
small fix for const generic used for static_assert_imm2 use const BS: u8
1 parent 596762d commit f61be77

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+
assert!(BS <= 3, "`bs` immediate value must be within 0..=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+
assert!(BS <= 3, "`bs` immediate value must be within 0..=3");
754754
let ans: u32;
755755
match BS {
756756
0 => unsafe {

0 commit comments

Comments
 (0)