2021-09-03 15:33:44 -07:00
|
|
|
use crate::field::field_types::Field;
|
|
|
|
|
use crate::field::packed_field::{PackedField, Singleton};
|
|
|
|
|
|
|
|
|
|
/// Points us to the default packing for a particular field. There may me multiple choices of
|
|
|
|
|
/// PackedField for a particular Field (e.g. Singleton works for all fields), but this is the
|
|
|
|
|
/// recommended one. The recommended packing varies by target_arch and target_feature.
|
|
|
|
|
pub trait Packable: Field {
|
|
|
|
|
type PackedType: PackedField<FieldType = Self>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<F: Field> Packable for F {
|
|
|
|
|
default type PackedType = Singleton<Self>;
|
|
|
|
|
}
|
2021-09-03 19:55:16 -07:00
|
|
|
|
2021-09-13 17:42:25 -07:00
|
|
|
#[cfg(target_feature = "avx2")]
|
|
|
|
|
impl Packable for crate::field::goldilocks_field::GoldilocksField {
|
|
|
|
|
type PackedType = crate::field::packed_avx2::PackedGoldilocksAVX2;
|
2021-09-03 19:55:16 -07:00
|
|
|
}
|