plonky2/field/src/packable.rs

19 lines
701 B
Rust
Raw Normal View History

use crate::field_types::Field;
use crate::packed_field::PackedField;
2021-09-03 15:33:44 -07:00
/// Points us to the default packing for a particular field. There may me multiple choices of
/// PackedField for a particular Field (e.g. every Field is also a PackedField), but this is the
2021-09-03 15:33:44 -07:00
/// recommended one. The recommended packing varies by target_arch and target_feature.
pub trait Packable: Field {
type Packing: PackedField<Scalar = Self>;
2021-09-03 15:33:44 -07:00
}
impl<F: Field> Packable for F {
default type Packing = Self;
2021-09-03 15:33:44 -07:00
}
2021-09-03 19:55:16 -07:00
2021-12-21 12:00:33 -08:00
#[cfg(all(target_arch = "x86_64", target_feature = "avx2"))]
impl Packable for crate::goldilocks_field::GoldilocksField {
type Packing = crate::arch::x86_64::avx2_goldilocks_field::Avx2GoldilocksField;
2021-09-03 19:55:16 -07:00
}