#[cfg(feature = "crc16")]
use crate::checksum::dispatchers::Crc16Fn;
#[cfg(feature = "crc24")]
use crate::checksum::dispatchers::Crc24Fn;
#[cfg(feature = "crc32")]
use crate::checksum::dispatchers::Crc32Fn;
#[cfg(feature = "crc64")]
use crate::checksum::dispatchers::Crc64Fn;
use crate::platform::Caps;
#[cfg(any(feature = "crc16", feature = "crc24", feature = "crc32", any(test, feature = "diag")))]
static ACTIVE_TABLE: crate::backend::cache::OnceCache<&'static KernelTable> = crate::backend::cache::OnceCache::new();
#[cfg(feature = "crc64")]
static ACTIVE_CRC64_TABLE: crate::backend::cache::OnceCache<&'static KernelTable> =
crate::backend::cache::OnceCache::new();
#[inline]
#[cfg(any(feature = "crc16", feature = "crc24", feature = "crc32", any(test, feature = "diag")))]
pub(crate) fn active_table() -> &'static KernelTable {
ACTIVE_TABLE.get_or_init(|| select_table(crate::platform::caps()))
}
#[cfg(feature = "crc64")]
#[inline]
pub(crate) fn active_crc64_table() -> &'static KernelTable {
ACTIVE_CRC64_TABLE.get_or_init(|| select_crc64_table(crate::platform::caps()))
}
const FAST_PATH_MAX: usize = 7;
#[cold]
#[inline]
fn cold_path() {}
#[cfg(feature = "crc64")]
#[inline(always)]
pub(crate) fn crc64_xz(data: &[u8]) -> u64 {
if data.len() <= FAST_PATH_MAX {
cold_path();
if data.is_empty() {
return 0;
}
return crate::checksum::crc64::portable::crc64_xz_bytewise(!0, data) ^ !0;
}
let table = active_crc64_table();
let kernel = table.select_fns(data.len()).crc64_xz;
kernel(!0, data) ^ !0
}
#[cfg(feature = "crc64")]
#[inline(always)]
pub(crate) fn crc64_nvme(data: &[u8]) -> u64 {
if data.len() <= FAST_PATH_MAX {
cold_path();
if data.is_empty() {
return 0;
}
return crate::checksum::crc64::portable::crc64_nvme_bytewise(!0, data) ^ !0;
}
let table = active_crc64_table();
let kernel = table.select_fns(data.len()).crc64_nvme;
kernel(!0, data) ^ !0
}
#[cfg(feature = "crc32")]
#[inline(always)]
pub(crate) fn crc32_ieee(data: &[u8]) -> u32 {
if data.len() <= FAST_PATH_MAX {
cold_path();
if data.is_empty() {
return 0;
}
return crate::checksum::crc32::portable::crc32_bytewise_ieee(!0, data) ^ !0;
}
#[cfg(target_arch = "aarch64")]
{
use crate::platform::caps::aarch64;
let caps = crate::platform::caps();
if caps.has(aarch64::PMULL_READY) && caps.has(aarch64::CRC_READY) {
if data.len() > 1024 && caps.has(aarch64::PMULL_EOR3_READY) {
return crate::checksum::crc32::aarch64::crc32_iso_hdlc_pmull_eor3_v9s3x2e_s3_safe(!0, data) ^ !0;
}
if data.len() < 128 {
return crate::checksum::crc32::aarch64::crc32_armv8_safe(!0, data) ^ !0;
}
return unsafe { crate::checksum::crc32::aarch64::crc32_ieee_fusion_inline(!0, data) } ^ !0;
}
if caps.has(aarch64::CRC_READY) {
return unsafe { crate::checksum::crc32::aarch64::crc32_ieee_hwcrc_inline(!0, data) } ^ !0;
}
}
let table = active_table();
let kernel = table.select_fns(data.len()).crc32_ieee;
kernel(!0, data) ^ !0
}
#[cfg(feature = "crc32")]
#[inline(always)]
pub(crate) fn crc32c(data: &[u8]) -> u32 {
if data.len() <= FAST_PATH_MAX {
cold_path();
if data.is_empty() {
return 0;
}
return crate::checksum::crc32::portable::crc32c_bytewise(!0, data) ^ !0;
}
#[cfg(target_arch = "aarch64")]
{
use crate::platform::caps::aarch64;
let caps = crate::platform::caps();
if caps.has(aarch64::PMULL_READY) && caps.has(aarch64::CRC_READY) {
if data.len() > 1024 && caps.has(aarch64::PMULL_EOR3_READY) {
return crate::checksum::crc32::aarch64::crc32c_iscsi_pmull_eor3_v9s3x2e_s3_safe(!0, data) ^ !0;
}
if data.len() < 128 {
return crate::checksum::crc32::aarch64::crc32c_armv8_safe(!0, data) ^ !0;
}
return unsafe { crate::checksum::crc32::aarch64::crc32c_iscsi_fusion_inline(!0, data) } ^ !0;
}
if caps.has(aarch64::CRC_READY) {
return unsafe { crate::checksum::crc32::aarch64::crc32c_iscsi_hwcrc_inline(!0, data) } ^ !0;
}
}
let table = active_table();
let kernel = table.select_fns(data.len()).crc32c;
kernel(!0, data) ^ !0
}
#[cfg(feature = "crc16")]
#[inline(always)]
pub(crate) fn crc16_ccitt(data: &[u8]) -> u16 {
if data.len() <= FAST_PATH_MAX {
cold_path();
if data.is_empty() {
return 0;
}
return crate::checksum::crc16::portable::crc16_ccitt_bytewise(0xFFFF, data) ^ 0xFFFF;
}
let table = active_table();
let kernel = table.select_fns(data.len()).crc16_ccitt;
kernel(0xFFFF, data) ^ 0xFFFF
}
#[cfg(feature = "crc16")]
#[inline(always)]
pub(crate) fn crc16_ibm(data: &[u8]) -> u16 {
if data.len() <= FAST_PATH_MAX {
cold_path();
if data.is_empty() {
return 0;
}
return crate::checksum::crc16::portable::crc16_ibm_bytewise(0, data);
}
let table = active_table();
let kernel = table.select_fns(data.len()).crc16_ibm;
kernel(0, data)
}
#[cfg(feature = "crc24")]
#[inline(always)]
pub(crate) fn crc24_openpgp(data: &[u8]) -> u32 {
const INIT: u32 = 0x00B7_04CE;
const MASK: u32 = 0x00FF_FFFF;
if data.len() <= FAST_PATH_MAX {
cold_path();
if data.is_empty() {
return INIT;
}
return crate::checksum::crc24::portable::crc24_openpgp_bytewise(INIT, data) & MASK;
}
let table = active_table();
let kernel = table.select_fns(data.len()).crc24_openpgp;
kernel(INIT, data) & MASK
}
#[derive(Clone, Copy)]
pub(crate) struct KernelFnSet {
#[cfg(feature = "crc16")]
pub crc16_ccitt: Crc16Fn,
#[cfg(feature = "crc16")]
pub crc16_ibm: Crc16Fn,
#[cfg(feature = "crc24")]
pub crc24_openpgp: Crc24Fn,
#[cfg(feature = "crc32")]
pub crc32_ieee: Crc32Fn,
#[cfg(feature = "crc32")]
pub crc32c: Crc32Fn,
#[cfg(feature = "crc64")]
pub crc64_xz: Crc64Fn,
#[cfg(feature = "crc64")]
pub crc64_nvme: Crc64Fn,
}
const _: () = assert!(core::mem::size_of::<KernelFnSet>() <= 64);
#[derive(Clone, Copy)]
pub(crate) struct KernelNameSet {
#[cfg(feature = "crc16")]
pub crc16_ccitt_name: &'static str,
#[cfg(feature = "crc16")]
pub crc16_ibm_name: &'static str,
#[cfg(feature = "crc24")]
pub crc24_openpgp_name: &'static str,
#[cfg(feature = "crc32")]
pub crc32_ieee_name: &'static str,
#[cfg(feature = "crc32")]
pub crc32c_name: &'static str,
#[cfg(feature = "crc64")]
pub crc64_xz_name: &'static str,
#[cfg(feature = "crc64")]
pub crc64_nvme_name: &'static str,
}
#[derive(Clone, Copy)]
pub(crate) struct KernelSet {
#[cfg(feature = "crc16")]
pub crc16_ccitt: Crc16Fn,
#[cfg(feature = "crc16")]
pub crc16_ccitt_name: &'static str,
#[cfg(feature = "crc16")]
pub crc16_ibm: Crc16Fn,
#[cfg(feature = "crc16")]
pub crc16_ibm_name: &'static str,
#[cfg(feature = "crc24")]
pub crc24_openpgp: Crc24Fn,
#[cfg(feature = "crc24")]
pub crc24_openpgp_name: &'static str,
#[cfg(feature = "crc32")]
pub crc32_ieee: Crc32Fn,
#[cfg(feature = "crc32")]
pub crc32_ieee_name: &'static str,
#[cfg(feature = "crc32")]
pub crc32c: Crc32Fn,
#[cfg(feature = "crc32")]
pub crc32c_name: &'static str,
#[cfg(feature = "crc64")]
pub crc64_xz: Crc64Fn,
#[cfg(feature = "crc64")]
pub crc64_xz_name: &'static str,
#[cfg(feature = "crc64")]
pub crc64_nvme: Crc64Fn,
#[cfg(feature = "crc64")]
pub crc64_nvme_name: &'static str,
}
impl KernelSet {
#[inline]
pub const fn fns(&self) -> KernelFnSet {
KernelFnSet {
#[cfg(feature = "crc16")]
crc16_ccitt: self.crc16_ccitt,
#[cfg(feature = "crc16")]
crc16_ibm: self.crc16_ibm,
#[cfg(feature = "crc24")]
crc24_openpgp: self.crc24_openpgp,
#[cfg(feature = "crc32")]
crc32_ieee: self.crc32_ieee,
#[cfg(feature = "crc32")]
crc32c: self.crc32c,
#[cfg(feature = "crc64")]
crc64_xz: self.crc64_xz,
#[cfg(feature = "crc64")]
crc64_nvme: self.crc64_nvme,
}
}
#[inline]
pub const fn names(&self) -> KernelNameSet {
KernelNameSet {
#[cfg(feature = "crc16")]
crc16_ccitt_name: self.crc16_ccitt_name,
#[cfg(feature = "crc16")]
crc16_ibm_name: self.crc16_ibm_name,
#[cfg(feature = "crc24")]
crc24_openpgp_name: self.crc24_openpgp_name,
#[cfg(feature = "crc32")]
crc32_ieee_name: self.crc32_ieee_name,
#[cfg(feature = "crc32")]
crc32c_name: self.crc32c_name,
#[cfg(feature = "crc64")]
crc64_xz_name: self.crc64_xz_name,
#[cfg(feature = "crc64")]
crc64_nvme_name: self.crc64_nvme_name,
}
}
}
#[derive(Clone, Copy)]
pub(crate) struct KernelTable {
pub requires: Caps,
pub boundaries: [usize; 3],
pub fns: [KernelFnSet; 4],
pub names: [KernelNameSet; 4],
}
const XS: usize = 0;
const S: usize = 1;
const M: usize = 2;
const L: usize = 3;
impl KernelTable {
pub const fn from_sets(
requires: Caps,
boundaries: [usize; 3],
xs: KernelSet,
s: KernelSet,
m: KernelSet,
l: KernelSet,
) -> Self {
Self {
requires,
boundaries,
fns: [xs.fns(), s.fns(), m.fns(), l.fns()],
names: [xs.names(), s.names(), m.names(), l.names()],
}
}
#[inline]
pub const fn select_fns(&self, len: usize) -> &KernelFnSet {
if len <= self.boundaries[0] {
&self.fns[XS]
} else if len <= self.boundaries[1] {
&self.fns[S]
} else if len <= self.boundaries[2] {
&self.fns[M]
} else {
&self.fns[L]
}
}
#[inline]
pub const fn select_names(&self, len: usize) -> &KernelNameSet {
if len <= self.boundaries[0] {
&self.names[XS]
} else if len <= self.boundaries[1] {
&self.names[S]
} else if len <= self.boundaries[2] {
&self.names[M]
} else {
&self.names[L]
}
}
#[cfg(any(test, feature = "diag"))]
#[cfg_attr(test, allow(dead_code))]
#[inline]
pub const fn is_hardware_accelerated(&self) -> bool {
!self.requires.is_empty()
}
}
macro_rules! kernel_table {
(
requires: $req:expr,
boundaries: $bounds:expr,
xs: $xs:expr,
s: $s:expr,
m: $m:expr,
l: $l:expr $(,)?
) => {
KernelTable::from_sets($req, $bounds, $xs, $s, $m, $l)
};
}
#[cfg(any(test, feature = "diag"))]
#[cfg_attr(test, allow(dead_code))]
#[inline]
pub fn is_hardware_accelerated() -> bool {
active_table().is_hardware_accelerated()
}
#[inline]
#[cfg(any(feature = "crc16", feature = "crc24", feature = "crc32", any(test, feature = "diag")))]
pub(crate) fn select_table(caps: Caps) -> &'static KernelTable {
if let Some(table) = capability_match(caps) {
debug_assert!(caps.has(table.requires), "capability_match returned an unsafe table");
if caps.has(table.requires) {
return table;
}
}
&PORTABLE_TABLE
}
#[cfg(feature = "crc64")]
#[inline]
pub(crate) fn select_crc64_table(caps: Caps) -> &'static KernelTable {
if let Some(table) = capability_match_crc64(caps) {
debug_assert!(
caps.has(table.requires),
"capability_match_crc64 returned an unsafe table"
);
if caps.has(table.requires) {
return table;
}
}
&PORTABLE_TABLE
}
#[inline]
fn capability_match(caps: Caps) -> Option<&'static KernelTable> {
let _ = caps;
#[cfg(target_arch = "aarch64")]
{
use crate::platform::caps::aarch64::{CRC_READY, PMULL_EOR3_READY, PMULL_READY};
#[cfg(all(feature = "std", not(miri)))]
if let Some(family) = crate::platform::detect::detect_aarch64_tune_family() {
match family {
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
crate::platform::detect::Aarch64TuneFamily::AppleM1M3 => {
if caps.has(aarch64_tables::APPLE_M1M3_TABLE.requires) {
return Some(&aarch64_tables::APPLE_M1M3_TABLE);
}
}
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
crate::platform::detect::Aarch64TuneFamily::AppleM4M5 => {
if caps.has(aarch64_tables::APPLE_M1M3_TABLE.requires) {
return Some(&aarch64_tables::APPLE_M1M3_TABLE);
}
}
#[cfg(any(target_os = "linux", target_os = "android"))]
crate::platform::detect::Aarch64TuneFamily::Graviton2 => {
if caps.has(aarch64_tables::GRAVITON2_TABLE.requires) {
return Some(&aarch64_tables::GRAVITON2_TABLE);
}
}
#[cfg(any(target_os = "linux", target_os = "android"))]
crate::platform::detect::Aarch64TuneFamily::Graviton3 => {
if caps.has(aarch64_tables::GRAVITON3_TABLE.requires) {
return Some(&aarch64_tables::GRAVITON3_TABLE);
}
}
#[cfg(any(target_os = "linux", target_os = "android"))]
crate::platform::detect::Aarch64TuneFamily::Graviton4 => {
if caps.has(aarch64_tables::GRAVITON4_TABLE.requires) {
return Some(&aarch64_tables::GRAVITON4_TABLE);
}
}
}
}
if caps.has(CRC_READY) && caps.has(PMULL_EOR3_READY) {
return Some(&aarch64_tables::GENERIC_ARM_PMULL_EOR3_TABLE);
}
if caps.has(CRC_READY) && caps.has(PMULL_READY) {
return Some(&aarch64_tables::GENERIC_ARM_PMULL_TABLE);
}
if caps.has(PMULL_READY) {
return Some(&aarch64_tables::GENERIC_ARM_PMULL_NO_CRC_TABLE);
}
if caps.has(CRC_READY) {
return Some(&aarch64_tables::GENERIC_ARM_CRC_ONLY_TABLE);
}
}
#[cfg(target_arch = "x86_64")]
{
use crate::platform::caps::x86::{CRC32C_READY, PCLMUL_READY, VPCLMUL_READY};
if caps.has(VPCLMUL_READY) && caps.has(PCLMUL_READY) && caps.has(CRC32C_READY) {
return Some(&GENERIC_X86_VPCLMUL_TABLE);
}
if caps.has(VPCLMUL_READY) && caps.has(PCLMUL_READY) {
return Some(&GENERIC_X86_VPCLMUL_NO_CRC32C_TABLE);
}
if caps.has(PCLMUL_READY) && caps.has(CRC32C_READY) {
return Some(&GENERIC_X86_PCLMUL_TABLE);
}
if caps.has(PCLMUL_READY) {
return Some(&GENERIC_X86_PCLMUL_NO_CRC32C_TABLE);
}
if caps.has(CRC32C_READY) {
return Some(&GENERIC_X86_CRC32C_ONLY_TABLE);
}
}
#[cfg(target_arch = "s390x")]
{
use crate::platform::caps::s390x::{Z13_READY, Z14_READY, Z15_READY, Z16_READY};
if caps.has(Z16_READY) {
return Some(&S390X_Z15_TABLE);
}
if caps.has(Z15_READY) {
return Some(&S390X_Z15_TABLE);
}
if caps.has(Z14_READY) {
return Some(&S390X_Z14_TABLE);
}
if caps.has(Z13_READY) {
return Some(&S390X_Z13_TABLE);
}
}
#[cfg(target_arch = "powerpc64")]
{
use crate::platform::caps::power::{POWER9_READY, POWER10_READY, VPMSUM_READY};
if caps.has(POWER10_READY) {
return Some(&POWER10_TABLE);
}
if caps.has(POWER9_READY) {
return Some(&POWER9_TABLE);
}
if caps.has(VPMSUM_READY) {
return Some(&POWER8_TABLE);
}
}
#[cfg(target_arch = "riscv64")]
{
use crate::platform::caps::riscv::{V, ZBC, ZVBC};
let v_zvbc = V.union(ZVBC);
if caps.has(v_zvbc) {
return Some(&RISCV64_ZVBC_TABLE);
}
if caps.has(ZBC) {
return Some(&RISCV64_ZBC_TABLE);
}
}
None
}
#[cfg(feature = "crc64")]
#[inline]
fn capability_match_crc64(caps: Caps) -> Option<&'static KernelTable> {
#[cfg(target_arch = "riscv64")]
{
use crate::platform::caps::riscv::{V, ZBC, ZVBC};
let v_zvbc = V.union(ZVBC);
if caps.has(v_zvbc) {
return Some(&RISCV64_CRC64_ZVBC_TABLE);
}
if caps.has(ZBC) {
return Some(&RISCV64_CRC64_ZBC_TABLE);
}
}
capability_match(caps)
}
const PORTABLE_SET: KernelSet = KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crate::checksum::crc16::portable::crc16_ccitt_slice8,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "portable/slice8",
#[cfg(feature = "crc16")]
crc16_ibm: crate::checksum::crc16::portable::crc16_ibm_slice8,
#[cfg(feature = "crc16")]
crc16_ibm_name: "portable/slice8",
#[cfg(feature = "crc24")]
crc24_openpgp: crate::checksum::crc24::portable::crc24_openpgp_slice8,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "portable/slice8",
#[cfg(feature = "crc32")]
crc32_ieee: crate::checksum::crc32::portable::crc32_slice16_ieee,
#[cfg(feature = "crc32")]
crc32_ieee_name: "portable/slice16",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
};
pub static PORTABLE_TABLE: KernelTable = KernelTable::from_sets(
Caps::NONE,
[64, 256, 4096],
PORTABLE_SET,
PORTABLE_SET,
PORTABLE_SET,
PORTABLE_SET,
);
#[cfg(target_arch = "aarch64")]
mod aarch64_tables {
use super::*;
#[cfg(feature = "crc16")]
use crate::checksum::crc16::kernels::aarch64 as crc16_k;
#[cfg(feature = "crc24")]
use crate::checksum::crc24::kernels::aarch64 as crc24_k;
#[cfg(feature = "crc32")]
use crate::checksum::crc32::kernels::aarch64 as crc32_k;
#[cfg(feature = "crc64")]
use crate::checksum::crc64::kernels::aarch64 as crc64_k;
#[cfg(all(feature = "crc16", not(miri), any(target_os = "linux", target_os = "android")))]
const G3_CRC16_PMULL_EOR3_2WAY_MAX_LEN: usize = 262_144;
#[cfg(all(feature = "crc16", not(miri), any(target_os = "linux", target_os = "android")))]
#[inline]
fn g3_crc16_ccitt_l_hybrid(crc: u16, data: &[u8]) -> u16 {
if data.len() <= G3_CRC16_PMULL_EOR3_2WAY_MAX_LEN {
(crc16_k::CCITT_PMULL_EOR3[1])(crc, data)
} else {
(crc16_k::CCITT_PMULL_EOR3[0])(crc, data)
}
}
#[cfg(all(feature = "crc16", not(miri), any(target_os = "linux", target_os = "android")))]
#[inline]
fn g3_crc16_ibm_l_hybrid(crc: u16, data: &[u8]) -> u16 {
if data.len() <= G3_CRC16_PMULL_EOR3_2WAY_MAX_LEN {
(crc16_k::IBM_PMULL_EOR3[1])(crc, data)
} else {
(crc16_k::IBM_PMULL_EOR3[0])(crc, data)
}
}
pub static APPLE_M1M3_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::aarch64::CRC_READY
.union(crate::platform::caps::aarch64::PMULL_EOR3_READY)
.union(crate::platform::caps::aarch64::PMULL_READY),
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_EOR3[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-eor3-v9s3x2e-s3-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL_SMALL,
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull-small",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL_EOR3[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull-eor3",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL_EOR3[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull-eor3",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_EOR3[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-eor3-v9s3x2e-s3",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_EOR3[0],
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-eor3-v9s3x2e-s3",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL_EOR3[1],
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull-eor3-2way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[1],
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull-2way",
},
};
#[cfg(all(not(miri), any(target_os = "linux", target_os = "android")))]
pub static GRAVITON2_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::aarch64::CRC_READY.union(crate::platform::caps::aarch64::PMULL_EOR3_READY),
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL_SMALL,
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull-small",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0], #[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0], #[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0], #[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL[0], #[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL[0], #[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0], #[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0], #[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0], #[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL[0], #[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL[0], #[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0], #[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_EOR3[0], #[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-eor3-v9s3x2e-s3",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_EOR3[0], #[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-eor3-v9s3x2e-s3",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL_EOR3[0], #[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull-eor3",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0], #[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
};
#[cfg(all(not(miri), any(target_os = "linux", target_os = "android")))]
const G3_XS: KernelSet = KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_SMALL_KERNEL, #[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_SMALL_KERNEL, #[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL_SMALL_KERNEL, #[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL_SMALL, #[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL_SMALL, #[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull-small",
};
#[cfg(all(not(miri), any(target_os = "linux", target_os = "android")))]
const G3_S: KernelSet = KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL[0], #[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL[0], #[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0], #[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0], #[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0], #[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
};
#[cfg(all(not(miri), any(target_os = "linux", target_os = "android")))]
const G3_M: KernelSet = KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_EOR3[0], #[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-eor3",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_EOR3[0], #[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-eor3",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0], #[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0], #[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[1], #[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull-2way",
};
#[cfg(all(not(miri), any(target_os = "linux", target_os = "android")))]
const G3_L: KernelSet = KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: g3_crc16_ccitt_l_hybrid,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-eor3-g3-ccitt-hybrid",
#[cfg(feature = "crc16")]
crc16_ibm: g3_crc16_ibm_l_hybrid,
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-eor3-g3-ibm-hybrid",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0], #[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_EOR3[0], #[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-eor3-v9s3x2e-s3",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_EOR3[0], #[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-eor3-v9s3x2e-s3",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL_EOR3[0], #[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull-eor3",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL_EOR3[0], #[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull-eor3",
};
#[cfg(all(not(miri), any(target_os = "linux", target_os = "android")))]
pub static GRAVITON3_TABLE: KernelTable = KernelTable::from_sets(
crate::platform::caps::aarch64::CRC_READY.union(crate::platform::caps::aarch64::PMULL_EOR3_READY),
[64, 256, 4096],
G3_XS,
G3_S,
G3_M,
G3_L,
);
#[cfg(all(not(miri), any(target_os = "linux", target_os = "android")))]
pub static GRAVITON4_TABLE: KernelTable = KernelTable::from_sets(
crate::platform::caps::aarch64::CRC_READY.union(crate::platform::caps::aarch64::PMULL_EOR3_READY),
[64, 256, 4096],
G3_XS,
G3_S,
KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_EOR3[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-eor3-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_EOR3[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-eor3-2way",
..G3_M
},
KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_EOR3[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-eor3-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_EOR3[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-eor3-2way",
..G3_L
},
);
pub static GENERIC_ARM_PMULL_EOR3_TABLE: KernelTable = APPLE_M1M3_TABLE;
pub static GENERIC_ARM_PMULL_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::aarch64::CRC_READY.union(crate::platform::caps::aarch64::PMULL_READY),
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL_SMALL,
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull-small",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PMULL[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/pmull-v9s3x2e-s3",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_PMULL[0],
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/pmull-v9s3x2e-s3",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
};
pub static GENERIC_ARM_PMULL_NO_CRC_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::aarch64::PMULL_READY,
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull-small",
#[cfg(feature = "crc32")]
crc32_ieee: crate::checksum::crc32::portable::crc32_bytewise_ieee,
#[cfg(feature = "crc32")]
crc32_ieee_name: crate::checksum::crc32::portable::BYTEWISE_KERNEL_NAME,
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_bytewise,
#[cfg(feature = "crc32")]
crc32c_name: crate::checksum::crc32::portable::BYTEWISE_KERNEL_NAME,
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL_SMALL,
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull-small",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crate::checksum::crc32::portable::crc32_slice16_ieee,
#[cfg(feature = "crc32")]
crc32_ieee_name: "portable/slice16",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crate::checksum::crc32::portable::crc32_slice16_ieee,
#[cfg(feature = "crc32")]
crc32_ieee_name: "portable/slice16",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "aarch64/pmull",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PMULL[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "aarch64/pmull",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PMULL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "aarch64/pmull",
#[cfg(feature = "crc32")]
crc32_ieee: crate::checksum::crc32::portable::crc32_slice16_ieee,
#[cfg(feature = "crc32")]
crc32_ieee_name: "portable/slice16",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PMULL[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "aarch64/pmull",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PMULL[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "aarch64/pmull",
},
};
pub static GENERIC_ARM_CRC_ONLY_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::aarch64::CRC_READY,
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crate::checksum::crc16::portable::crc16_ccitt_slice8,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "portable/slice8",
#[cfg(feature = "crc16")]
crc16_ibm: crate::checksum::crc16::portable::crc16_ibm_slice8,
#[cfg(feature = "crc16")]
crc16_ibm_name: "portable/slice8",
#[cfg(feature = "crc24")]
crc24_openpgp: crate::checksum::crc24::portable::crc24_openpgp_slice8,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "portable/slice8",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_HWCRC[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/hwcrc",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0],
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crate::checksum::crc16::portable::crc16_ccitt_slice8,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "portable/slice8",
#[cfg(feature = "crc16")]
crc16_ibm: crate::checksum::crc16::portable::crc16_ibm_slice8,
#[cfg(feature = "crc16")]
crc16_ibm_name: "portable/slice8",
#[cfg(feature = "crc24")]
crc24_openpgp: crate::checksum::crc24::portable::crc24_openpgp_slice8,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "portable/slice8",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_HWCRC[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/hwcrc",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0],
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crate::checksum::crc16::portable::crc16_ccitt_slice8,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "portable/slice8",
#[cfg(feature = "crc16")]
crc16_ibm: crate::checksum::crc16::portable::crc16_ibm_slice8,
#[cfg(feature = "crc16")]
crc16_ibm_name: "portable/slice8",
#[cfg(feature = "crc24")]
crc24_openpgp: crate::checksum::crc24::portable::crc24_openpgp_slice8,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "portable/slice8",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_HWCRC[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/hwcrc",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0],
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crate::checksum::crc16::portable::crc16_ccitt_slice8,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "portable/slice8",
#[cfg(feature = "crc16")]
crc16_ibm: crate::checksum::crc16::portable::crc16_ibm_slice8,
#[cfg(feature = "crc16")]
crc16_ibm_name: "portable/slice8",
#[cfg(feature = "crc24")]
crc24_openpgp: crate::checksum::crc24::portable::crc24_openpgp_slice8,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "portable/slice8",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_HWCRC[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "aarch64/hwcrc",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0],
#[cfg(feature = "crc32")]
crc32c_name: "aarch64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
};
}
#[cfg(target_arch = "x86_64")]
mod x86_64_tables {
use super::*;
#[cfg(feature = "crc16")]
use crate::checksum::crc16::kernels::x86_64 as crc16_k;
#[cfg(feature = "crc24")]
use crate::checksum::crc24::kernels::x86_64 as crc24_k;
#[cfg(feature = "crc32")]
use crate::checksum::crc32::kernels::x86_64 as crc32_k;
#[cfg(feature = "crc64")]
use crate::checksum::crc64::kernels::x86_64 as crc64_k;
#[cfg(feature = "crc64")]
const ZEN4_CRC64_XZ_2WAY_MAX_LEN: usize = 262_144;
#[cfg(feature = "crc64")]
#[inline]
fn zen4_crc64_xz_l_hybrid(crc: u64, data: &[u8]) -> u64 {
if data.len() <= ZEN4_CRC64_XZ_2WAY_MAX_LEN {
(crc64_k::XZ_VPCLMUL[1])(crc, data)
} else {
(crc64_k::XZ_VPCLMUL[4])(crc, data)
}
}
pub static ZEN4_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::x86::VPCLMUL_READY
.union(crate::platform::caps::x86::PCLMUL_READY)
.union(crate::platform::caps::x86::CRC32C_READY),
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul-small",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL_SMALL_KERNEL, #[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0], #[cfg(feature = "crc32")]
crc32c_name: "x86_64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-small",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPCLMUL[1], #[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPCLMUL[1], #[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPCLMUL[3], #[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/vpclmul-7way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPCLMUL[0], #[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/vpclmul",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0], #[cfg(feature = "crc32")]
crc32c_name: "x86_64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPCLMUL[0], #[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/vpclmul",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPCLMUL[0], #[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/vpclmul",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPCLMUL[1], #[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPCLMUL[1], #[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPCLMUL[2], #[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/vpclmul-4way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPCLMUL[1], #[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_FUSION_VPCLMUL[0], #[cfg(feature = "crc32")]
crc32c_name: "x86_64/fusion-vpclmul-v3x2",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPCLMUL[1], #[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPCLMUL[1], #[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/vpclmul-2way",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPCLMUL[2], #[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/vpclmul-4way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPCLMUL[1], #[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPCLMUL[2], #[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/vpclmul-4way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPCLMUL[1], #[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_FUSION_VPCLMUL[0], #[cfg(feature = "crc32")]
crc32c_name: "x86_64/fusion-vpclmul-v3x2",
#[cfg(feature = "crc64")]
crc64_xz: zen4_crc64_xz_l_hybrid,
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/vpclmul-zen4-xz-hybrid",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPCLMUL[1], #[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/vpclmul-2way",
},
};
pub static GENERIC_X86_VPCLMUL_TABLE: KernelTable = ZEN4_TABLE;
pub static GENERIC_X86_VPCLMUL_NO_CRC32C_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::x86::VPCLMUL_READY.union(crate::platform::caps::x86::PCLMUL_READY),
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul-small",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul-small",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_bytewise,
#[cfg(feature = "crc32")]
crc32c_name: crate::checksum::crc32::portable::BYTEWISE_KERNEL_NAME,
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-small",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPCLMUL[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPCLMUL[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPCLMUL[3],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/vpclmul-7way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPCLMUL[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/vpclmul",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPCLMUL[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/vpclmul",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPCLMUL[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/vpclmul",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPCLMUL[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPCLMUL[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPCLMUL[4],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/vpclmul-8way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPCLMUL[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPCLMUL[1],
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPCLMUL[1],
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/vpclmul-2way",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPCLMUL[2],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/vpclmul-4way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPCLMUL[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPCLMUL[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPCLMUL[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/vpclmul-2way",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPCLMUL_4X512,
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/vpclmul-4x512",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPCLMUL[2],
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/vpclmul-4way",
},
};
pub static GENERIC_X86_PCLMUL_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::x86::PCLMUL_READY.union(crate::platform::caps::x86::CRC32C_READY),
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul-small",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul-small",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0],
#[cfg(feature = "crc32")]
crc32c_name: "x86_64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-small",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL[0], #[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL[2], #[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul-4way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL[2], #[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul-4way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0],
#[cfg(feature = "crc32")]
crc32c_name: "x86_64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL_SMALL, #[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-small",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL[3], #[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul-7way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL[0], #[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL[1], #[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL[0], #[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[1], #[cfg(feature = "crc32")]
crc32c_name: "x86_64/hwcrc-2way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL[2], #[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul-4way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL[1], #[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-2way",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL[0], #[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL[1], #[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL[1], #[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_FUSION_SSE[1], #[cfg(feature = "crc32")]
crc32c_name: "x86_64/fusion-sse-v4s3x3-2way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL[0], #[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL[1], #[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-2way",
},
};
pub static GENERIC_X86_PCLMUL_NO_CRC32C_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::x86::PCLMUL_READY,
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul-small",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul-small",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul-small",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL_SMALL_KERNEL,
#[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul-small",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_bytewise,
#[cfg(feature = "crc32")]
crc32c_name: crate::checksum::crc32::portable::BYTEWISE_KERNEL_NAME,
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-small",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL[2],
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul-4way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL[2],
#[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul-4way",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul-small",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL_SMALL,
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-small",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL[3],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul-7way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL[2],
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul-4way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL[1],
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-2way",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_PCLMUL[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "x86_64/pclmul",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_PCLMUL[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "x86_64/pclmul-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_PCLMUL[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "x86_64/pclmul-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_PCLMUL[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "x86_64/pclmul-2way",
#[cfg(feature = "crc32")]
crc32c: crate::checksum::crc32::portable::crc32c_slice16,
#[cfg(feature = "crc32")]
crc32c_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_PCLMUL[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "x86_64/pclmul",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_PCLMUL[1],
#[cfg(feature = "crc64")]
crc64_nvme_name: "x86_64/pclmul-2way",
},
};
pub static GENERIC_X86_CRC32C_ONLY_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::x86::CRC32C_READY,
boundaries: [64, 256, 4096],
xs: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crate::checksum::crc16::portable::crc16_ccitt_slice8,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "portable/slice8",
#[cfg(feature = "crc16")]
crc16_ibm: crate::checksum::crc16::portable::crc16_ibm_slice8,
#[cfg(feature = "crc16")]
crc16_ibm_name: "portable/slice8",
#[cfg(feature = "crc24")]
crc24_openpgp: crate::checksum::crc24::portable::crc24_openpgp_slice8,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "portable/slice8",
#[cfg(feature = "crc32")]
crc32_ieee: crate::checksum::crc32::portable::crc32_bytewise_ieee,
#[cfg(feature = "crc32")]
crc32_ieee_name: crate::checksum::crc32::portable::BYTEWISE_KERNEL_NAME,
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0],
#[cfg(feature = "crc32")]
crc32c_name: "x86_64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crate::checksum::crc16::portable::crc16_ccitt_slice8,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "portable/slice8",
#[cfg(feature = "crc16")]
crc16_ibm: crate::checksum::crc16::portable::crc16_ibm_slice8,
#[cfg(feature = "crc16")]
crc16_ibm_name: "portable/slice8",
#[cfg(feature = "crc24")]
crc24_openpgp: crate::checksum::crc24::portable::crc24_openpgp_slice8,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "portable/slice8",
#[cfg(feature = "crc32")]
crc32_ieee: crate::checksum::crc32::portable::crc32_slice16_ieee,
#[cfg(feature = "crc32")]
crc32_ieee_name: "portable/slice16",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[0],
#[cfg(feature = "crc32")]
crc32c_name: "x86_64/hwcrc",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crate::checksum::crc16::portable::crc16_ccitt_slice8,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "portable/slice8",
#[cfg(feature = "crc16")]
crc16_ibm: crate::checksum::crc16::portable::crc16_ibm_slice8,
#[cfg(feature = "crc16")]
crc16_ibm_name: "portable/slice8",
#[cfg(feature = "crc24")]
crc24_openpgp: crate::checksum::crc24::portable::crc24_openpgp_slice8,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "portable/slice8",
#[cfg(feature = "crc32")]
crc32_ieee: crate::checksum::crc32::portable::crc32_slice16_ieee,
#[cfg(feature = "crc32")]
crc32_ieee_name: "portable/slice16",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[1],
#[cfg(feature = "crc32")]
crc32c_name: "x86_64/hwcrc-2way",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crate::checksum::crc16::portable::crc16_ccitt_slice8,
#[cfg(feature = "crc16")]
crc16_ccitt_name: "portable/slice8",
#[cfg(feature = "crc16")]
crc16_ibm: crate::checksum::crc16::portable::crc16_ibm_slice8,
#[cfg(feature = "crc16")]
crc16_ibm_name: "portable/slice8",
#[cfg(feature = "crc24")]
crc24_openpgp: crate::checksum::crc24::portable::crc24_openpgp_slice8,
#[cfg(feature = "crc24")]
crc24_openpgp_name: "portable/slice8",
#[cfg(feature = "crc32")]
crc32_ieee: crate::checksum::crc32::portable::crc32_slice16_ieee,
#[cfg(feature = "crc32")]
crc32_ieee_name: "portable/slice16",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_HWCRC[1],
#[cfg(feature = "crc32")]
crc32c_name: "x86_64/hwcrc-2way",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
};
}
#[cfg(target_arch = "x86_64")]
pub use x86_64_tables::*;
#[cfg(target_arch = "s390x")]
mod s390x_tables {
use super::*;
#[cfg(feature = "crc16")]
use crate::checksum::crc16::kernels::s390x as crc16_k;
#[cfg(feature = "crc24")]
use crate::checksum::crc24::kernels::s390x as crc24_k;
#[cfg(feature = "crc32")]
use crate::checksum::crc32::kernels::s390x as crc32_k;
#[cfg(feature = "crc64")]
use crate::checksum::crc64::kernels::s390x as crc64_k;
pub static S390X_Z13_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::s390x::Z13_READY,
boundaries: [64, 256, 4096],
xs: PORTABLE_SET,
s: PORTABLE_SET,
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VGFM[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "s390x/vgfm",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VGFM[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "s390x/vgfm",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VGFM[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "s390x/vgfm",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VGFM[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "s390x/vgfm",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VGFM[0],
#[cfg(feature = "crc32")]
crc32c_name: "s390x/vgfm",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VGFM[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "s390x/vgfm",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VGFM[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "s390x/vgfm",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VGFM[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "s390x/vgfm-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VGFM[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "s390x/vgfm-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VGFM[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "s390x/vgfm-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VGFM[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "s390x/vgfm-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VGFM[1],
#[cfg(feature = "crc32")]
crc32c_name: "s390x/vgfm-2way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VGFM[1],
#[cfg(feature = "crc64")]
crc64_xz_name: "s390x/vgfm-2way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VGFM[1],
#[cfg(feature = "crc64")]
crc64_nvme_name: "s390x/vgfm-2way",
},
};
pub static S390X_Z14_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::s390x::Z13_READY,
boundaries: [64, 128, 4096],
xs: PORTABLE_SET,
s: PORTABLE_SET,
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VGFM[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "s390x/vgfm",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VGFM[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "s390x/vgfm",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VGFM[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "s390x/vgfm",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VGFM[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "s390x/vgfm",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VGFM[0],
#[cfg(feature = "crc32")]
crc32c_name: "s390x/vgfm",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VGFM[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "s390x/vgfm",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VGFM[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "s390x/vgfm",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VGFM[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "s390x/vgfm-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VGFM[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "s390x/vgfm-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VGFM[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "s390x/vgfm-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VGFM[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "s390x/vgfm-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VGFM[1],
#[cfg(feature = "crc32")]
crc32c_name: "s390x/vgfm-2way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VGFM[1],
#[cfg(feature = "crc64")]
crc64_xz_name: "s390x/vgfm-2way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VGFM[1],
#[cfg(feature = "crc64")]
crc64_nvme_name: "s390x/vgfm-2way",
},
};
pub static S390X_Z15_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::s390x::Z13_READY,
boundaries: [63, 63, 4096],
xs: PORTABLE_SET,
s: PORTABLE_SET,
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VGFM[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "s390x/vgfm",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VGFM[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "s390x/vgfm",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VGFM[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "s390x/vgfm",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VGFM[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "s390x/vgfm",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VGFM[0],
#[cfg(feature = "crc32")]
crc32c_name: "s390x/vgfm",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VGFM[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "s390x/vgfm",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VGFM[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "s390x/vgfm",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VGFM[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "s390x/vgfm-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VGFM[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "s390x/vgfm-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VGFM[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "s390x/vgfm-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VGFM[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "s390x/vgfm-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VGFM[1],
#[cfg(feature = "crc32")]
crc32c_name: "s390x/vgfm-2way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VGFM[1],
#[cfg(feature = "crc64")]
crc64_xz_name: "s390x/vgfm-2way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VGFM[1],
#[cfg(feature = "crc64")]
crc64_nvme_name: "s390x/vgfm-2way",
},
};
}
#[cfg(target_arch = "s390x")]
pub use s390x_tables::*;
#[cfg(target_arch = "powerpc64")]
mod power_tables {
use super::*;
#[cfg(feature = "crc16")]
use crate::checksum::crc16::kernels::power as crc16_k;
#[cfg(feature = "crc24")]
use crate::checksum::crc24::kernels::power as crc24_k;
#[cfg(feature = "crc32")]
use crate::checksum::crc32::kernels::power as crc32_k;
#[cfg(feature = "crc64")]
use crate::checksum::crc64::kernels::power as crc64_k;
pub static POWER8_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::power::VPMSUM_READY,
boundaries: [64, 128, 4096],
xs: PORTABLE_SET,
s: PORTABLE_SET,
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPMSUM[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "power/vpmsum",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPMSUM[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "power/vpmsum",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPMSUM[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "power/vpmsum",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPMSUM[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "power/vpmsum",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VPMSUM[0],
#[cfg(feature = "crc32")]
crc32c_name: "power/vpmsum",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPMSUM[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "power/vpmsum",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPMSUM[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "power/vpmsum",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPMSUM[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "power/vpmsum-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPMSUM[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "power/vpmsum-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPMSUM[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "power/vpmsum-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPMSUM[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "power/vpmsum-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VPMSUM[1],
#[cfg(feature = "crc32")]
crc32c_name: "power/vpmsum-2way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPMSUM[1],
#[cfg(feature = "crc64")]
crc64_xz_name: "power/vpmsum-2way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPMSUM[1],
#[cfg(feature = "crc64")]
crc64_nvme_name: "power/vpmsum-2way",
},
};
pub static POWER9_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::power::VPMSUM_READY,
boundaries: [64, 64, 4096],
xs: PORTABLE_SET,
s: PORTABLE_SET,
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPMSUM[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "power/vpmsum",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPMSUM[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "power/vpmsum",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPMSUM[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "power/vpmsum",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPMSUM[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "power/vpmsum",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VPMSUM[0],
#[cfg(feature = "crc32")]
crc32c_name: "power/vpmsum",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPMSUM[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "power/vpmsum",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPMSUM[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "power/vpmsum",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPMSUM[2],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "power/vpmsum-4way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPMSUM[2],
#[cfg(feature = "crc16")]
crc16_ibm_name: "power/vpmsum-4way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPMSUM[2],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "power/vpmsum-4way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPMSUM[2],
#[cfg(feature = "crc32")]
crc32_ieee_name: "power/vpmsum-4way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VPMSUM[2],
#[cfg(feature = "crc32")]
crc32c_name: "power/vpmsum-4way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPMSUM[2],
#[cfg(feature = "crc64")]
crc64_xz_name: "power/vpmsum-4way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPMSUM[2],
#[cfg(feature = "crc64")]
crc64_nvme_name: "power/vpmsum-4way",
},
};
pub static POWER10_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::power::VPMSUM_READY,
boundaries: [63, 63, 4096],
xs: PORTABLE_SET,
s: PORTABLE_SET,
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPMSUM[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "power/vpmsum",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPMSUM[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "power/vpmsum",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPMSUM[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "power/vpmsum",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPMSUM[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "power/vpmsum",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VPMSUM[0],
#[cfg(feature = "crc32")]
crc32c_name: "power/vpmsum",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPMSUM[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "power/vpmsum",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPMSUM[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "power/vpmsum",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_VPMSUM[2],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "power/vpmsum-4way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_VPMSUM[2],
#[cfg(feature = "crc16")]
crc16_ibm_name: "power/vpmsum-4way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_VPMSUM[2],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "power/vpmsum-4way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_VPMSUM[2],
#[cfg(feature = "crc32")]
crc32_ieee_name: "power/vpmsum-4way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_VPMSUM[2],
#[cfg(feature = "crc32")]
crc32c_name: "power/vpmsum-4way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_VPMSUM[2],
#[cfg(feature = "crc64")]
crc64_xz_name: "power/vpmsum-4way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_VPMSUM[2],
#[cfg(feature = "crc64")]
crc64_nvme_name: "power/vpmsum-4way",
},
};
}
#[cfg(target_arch = "powerpc64")]
pub use power_tables::*;
#[cfg(target_arch = "riscv64")]
mod riscv64_tables {
use super::*;
#[cfg(feature = "crc16")]
use crate::checksum::crc16::kernels::riscv64 as crc16_k;
#[cfg(feature = "crc24")]
use crate::checksum::crc24::kernels::riscv64 as crc24_k;
#[cfg(feature = "crc32")]
use crate::checksum::crc32::kernels::riscv64 as crc32_k;
#[cfg(feature = "crc64")]
use crate::checksum::crc64::kernels::riscv64 as crc64_k;
pub static RISCV64_ZBC_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::riscv::ZBC,
boundaries: [63, 1024, 4096],
xs: PORTABLE_SET,
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_ZBC[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "riscv64/zbc",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_ZBC[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "riscv64/zbc",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_ZBC[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "riscv64/zbc",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_ZBC[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "riscv64/zbc",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_ZBC[0],
#[cfg(feature = "crc32")]
crc32c_name: "riscv64/zbc",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_ZBC[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "riscv64/zbc-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_ZBC[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "riscv64/zbc-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_ZBC[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "riscv64/zbc-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_ZBC[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "riscv64/zbc-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_ZBC[1],
#[cfg(feature = "crc32")]
crc32c_name: "riscv64/zbc-2way",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_ZBC[2],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "riscv64/zbc-4way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_ZBC[2],
#[cfg(feature = "crc16")]
crc16_ibm_name: "riscv64/zbc-4way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_ZBC[2],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "riscv64/zbc-4way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_ZBC[2],
#[cfg(feature = "crc32")]
crc32_ieee_name: "riscv64/zbc-4way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_ZBC[2],
#[cfg(feature = "crc32")]
crc32c_name: "riscv64/zbc-4way",
#[cfg(feature = "crc64")]
crc64_xz: crate::checksum::crc64::portable::crc64_slice16_xz,
#[cfg(feature = "crc64")]
crc64_xz_name: "portable/slice16",
#[cfg(feature = "crc64")]
crc64_nvme: crate::checksum::crc64::portable::crc64_slice16_nvme,
#[cfg(feature = "crc64")]
crc64_nvme_name: "portable/slice16",
},
};
pub static RISCV64_ZVBC_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::riscv::V.union(crate::platform::caps::riscv::ZVBC),
boundaries: [63, 1024, 4096],
xs: PORTABLE_SET,
s: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_ZVBC[0],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "riscv64/zvbc",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_ZVBC[0],
#[cfg(feature = "crc16")]
crc16_ibm_name: "riscv64/zvbc",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_ZVBC[0],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "riscv64/zvbc",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_ZVBC[0],
#[cfg(feature = "crc32")]
crc32_ieee_name: "riscv64/zvbc",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_ZVBC[0],
#[cfg(feature = "crc32")]
crc32c_name: "riscv64/zvbc",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_ZVBC[0],
#[cfg(feature = "crc64")]
crc64_xz_name: "riscv64/zvbc",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_ZVBC[0],
#[cfg(feature = "crc64")]
crc64_nvme_name: "riscv64/zvbc",
},
m: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_ZVBC[1],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "riscv64/zvbc-2way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_ZVBC[1],
#[cfg(feature = "crc16")]
crc16_ibm_name: "riscv64/zvbc-2way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_ZVBC[1],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "riscv64/zvbc-2way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_ZVBC[1],
#[cfg(feature = "crc32")]
crc32_ieee_name: "riscv64/zvbc-2way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_ZVBC[1],
#[cfg(feature = "crc32")]
crc32c_name: "riscv64/zvbc-2way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_ZVBC[1],
#[cfg(feature = "crc64")]
crc64_xz_name: "riscv64/zvbc-2way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_ZVBC[1],
#[cfg(feature = "crc64")]
crc64_nvme_name: "riscv64/zvbc-2way",
},
l: KernelSet {
#[cfg(feature = "crc16")]
crc16_ccitt: crc16_k::CCITT_ZVBC[2],
#[cfg(feature = "crc16")]
crc16_ccitt_name: "riscv64/zvbc-4way",
#[cfg(feature = "crc16")]
crc16_ibm: crc16_k::IBM_ZVBC[2],
#[cfg(feature = "crc16")]
crc16_ibm_name: "riscv64/zvbc-4way",
#[cfg(feature = "crc24")]
crc24_openpgp: crc24_k::OPENPGP_ZVBC[2],
#[cfg(feature = "crc24")]
crc24_openpgp_name: "riscv64/zvbc-4way",
#[cfg(feature = "crc32")]
crc32_ieee: crc32_k::CRC32_ZVBC[2],
#[cfg(feature = "crc32")]
crc32_ieee_name: "riscv64/zvbc-4way",
#[cfg(feature = "crc32")]
crc32c: crc32_k::CRC32C_ZVBC[2],
#[cfg(feature = "crc32")]
crc32c_name: "riscv64/zvbc-4way",
#[cfg(feature = "crc64")]
crc64_xz: crc64_k::XZ_ZVBC[2],
#[cfg(feature = "crc64")]
crc64_xz_name: "riscv64/zvbc-4way",
#[cfg(feature = "crc64")]
crc64_nvme: crc64_k::NVME_ZVBC[2],
#[cfg(feature = "crc64")]
crc64_nvme_name: "riscv64/zvbc-4way",
},
};
#[cfg(feature = "crc64")]
#[cfg(feature = "crc64")]
pub static RISCV64_CRC64_ZBC_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::riscv::ZBC,
boundaries: [128, 4096, 16384],
xs: PORTABLE_SET,
s: PORTABLE_SET,
m: PORTABLE_SET,
l: PORTABLE_SET,
};
#[cfg(feature = "crc64")]
pub static RISCV64_CRC64_ZVBC_TABLE: KernelTable = kernel_table! {
requires: crate::platform::caps::riscv::V.union(crate::platform::caps::riscv::ZVBC),
boundaries: [63, 1024, 4096],
xs: PORTABLE_SET,
s: PORTABLE_SET,
m: PORTABLE_SET,
l: PORTABLE_SET,
};
}
#[cfg(target_arch = "riscv64")]
pub use riscv64_tables::*;
#[cfg(test)]
mod tests {
use alloc::vec::Vec;
use super::*;
#[test]
fn test_portable_table_all_sizes() {
let table = &PORTABLE_TABLE;
assert!(core::ptr::eq(table.select_fns(0), &table.fns[XS]));
assert!(core::ptr::eq(table.select_fns(64), &table.fns[XS]));
assert!(core::ptr::eq(table.select_fns(65), &table.fns[S]));
assert!(core::ptr::eq(table.select_fns(256), &table.fns[S]));
assert!(core::ptr::eq(table.select_fns(257), &table.fns[M]));
assert!(core::ptr::eq(table.select_fns(4096), &table.fns[M]));
assert!(core::ptr::eq(table.select_fns(4097), &table.fns[L]));
assert!(core::ptr::eq(table.select_fns(1_000_000), &table.fns[L]));
}
#[test]
#[cfg(target_arch = "s390x")]
fn test_s390x_z15_uses_vgfm_at_64b() {
let names = S390X_Z15_TABLE.select_names(64);
#[cfg(feature = "crc32")]
assert_eq!(names.crc32_ieee_name, "s390x/vgfm");
#[cfg(feature = "crc64")]
assert_eq!(names.crc64_nvme_name, "s390x/vgfm");
}
#[test]
#[cfg(target_arch = "powerpc64")]
fn test_power10_uses_vpmsum_at_64b() {
let names = POWER10_TABLE.select_names(64);
#[cfg(feature = "crc32")]
assert_eq!(names.crc32_ieee_name, "power/vpmsum");
#[cfg(feature = "crc64")]
assert_eq!(names.crc64_nvme_name, "power/vpmsum");
}
#[test]
#[cfg(target_arch = "riscv64")]
fn test_riscv64_short_thresholds_keep_crc64_portable_at_64b() {
let crc_names = RISCV64_ZVBC_TABLE.select_names(64);
#[cfg(feature = "crc32")]
assert_eq!(crc_names.crc32_ieee_name, "riscv64/zvbc");
#[cfg(feature = "crc32")]
assert_eq!(crc_names.crc32c_name, "riscv64/zvbc");
#[cfg(feature = "crc64")]
{
let crc64_names = RISCV64_CRC64_ZVBC_TABLE.select_names(64);
assert_eq!(crc64_names.crc64_xz_name, "portable/slice16");
assert_eq!(crc64_names.crc64_nvme_name, "portable/slice16");
}
}
#[test]
fn test_select_table_fallback() {
let table = select_table(Caps::NONE);
assert!(core::ptr::eq(table, &PORTABLE_TABLE));
}
const TEST_DATA: &[u8] = b"123456789";
#[test]
#[cfg(feature = "crc64")]
fn test_crc64_xz_oneshot() {
let crc = crc64_xz(TEST_DATA);
assert_eq!(crc, 0x995DC9BBDF1939FA, "CRC-64/XZ check value mismatch");
}
#[test]
#[cfg(feature = "crc64")]
fn test_crc64_nvme_oneshot() {
let crc = crc64_nvme(TEST_DATA);
assert_eq!(crc, 0xAE8B14860A799888, "CRC-64/NVME check value mismatch");
}
#[test]
#[cfg(feature = "crc32")]
fn test_crc32_ieee_oneshot() {
let crc = crc32_ieee(TEST_DATA);
assert_eq!(crc, 0xCBF43926, "CRC-32/IEEE check value mismatch");
}
#[test]
#[cfg(feature = "crc32")]
fn test_crc32c_oneshot() {
let crc = crc32c(TEST_DATA);
assert_eq!(crc, 0xE3069283, "CRC-32C check value mismatch");
}
#[test]
#[cfg(feature = "crc16")]
fn test_crc16_ccitt_oneshot() {
let crc = crc16_ccitt(TEST_DATA);
assert_eq!(crc, 0x906E, "CRC-16/CCITT check value mismatch");
}
#[test]
#[cfg(feature = "crc16")]
fn test_crc16_ibm_oneshot() {
let crc = crc16_ibm(TEST_DATA);
assert_eq!(crc, 0xBB3D, "CRC-16/IBM check value mismatch");
}
#[test]
#[cfg(feature = "crc24")]
fn test_crc24_openpgp_oneshot() {
let crc = crc24_openpgp(TEST_DATA);
assert_eq!(crc, 0x21CF02, "CRC-24/OpenPGP check value mismatch");
}
#[test]
fn test_empty_data() {
#[cfg(feature = "crc64")]
assert_eq!(crc64_xz(&[]), 0, "CRC-64/XZ of empty data");
#[cfg(feature = "crc64")]
assert_eq!(crc64_nvme(&[]), 0, "CRC-64/NVME of empty data");
#[cfg(feature = "crc32")]
assert_eq!(crc32_ieee(&[]), 0, "CRC-32/IEEE of empty data");
#[cfg(feature = "crc32")]
assert_eq!(crc32c(&[]), 0, "CRC-32C of empty data");
#[cfg(feature = "crc16")]
assert_eq!(crc16_ccitt(&[]), 0, "CRC-16/CCITT of empty data");
#[cfg(feature = "crc16")]
assert_eq!(crc16_ibm(&[]), 0, "CRC-16/IBM of empty data");
#[cfg(feature = "crc24")]
assert_eq!(crc24_openpgp(&[]), 0x00B7_04CE, "CRC-24/OpenPGP of empty data");
}
#[test]
fn test_various_sizes() {
let sizes = [1, 64, 65, 256, 257, 4096, 4097, 65536];
for &size in &sizes {
let data: Vec<u8> = (0..size).map(|i| (i % 256) as u8).collect();
#[cfg(feature = "crc64")]
let _ = crc64_xz(&data);
#[cfg(feature = "crc64")]
let _ = crc64_nvme(&data);
#[cfg(feature = "crc32")]
let _ = crc32_ieee(&data);
#[cfg(feature = "crc32")]
let _ = crc32c(&data);
#[cfg(feature = "crc16")]
let _ = crc16_ccitt(&data);
#[cfg(feature = "crc16")]
let _ = crc16_ibm(&data);
#[cfg(feature = "crc24")]
let _ = crc24_openpgp(&data);
}
}
#[test]
fn test_active_table_caching() {
let table1 = active_table();
let table2 = active_table();
assert!(
core::ptr::eq(table1, table2),
"active_table should return cached reference"
);
}
#[test]
fn kernel_fn_set_fits_cache_line() {
let mut expected_fields = 0usize;
#[cfg(feature = "crc16")]
{
expected_fields += 2;
}
#[cfg(feature = "crc24")]
{
expected_fields += 1;
}
#[cfg(feature = "crc32")]
{
expected_fields += 2;
}
#[cfg(feature = "crc64")]
{
expected_fields += 2;
}
let expected_size = expected_fields * core::mem::size_of::<usize>();
let size = core::mem::size_of::<KernelFnSet>();
assert!(
size <= 64,
"KernelFnSet is {size} bytes, must be <= 64 for cache-line fit"
);
assert_eq!(
size, expected_size,
"KernelFnSet should match the active checksum function pointer count"
);
}
#[test]
fn kernel_name_set_is_separate() {
let fn_size = core::mem::size_of::<KernelFnSet>();
let name_size = core::mem::size_of::<KernelNameSet>();
let combined_size = core::mem::size_of::<KernelSet>();
assert_eq!(
fn_size.strict_add(name_size),
combined_size,
"KernelFnSet + KernelNameSet should equal KernelSet"
);
}
}