Trait scuttlebutt::field::SmallBinaryField
source · [−]pub unsafe trait SmallBinaryField: FiniteField<PrimeField = F2> + TransparentWrapper<u64> + Zeroable {
fn from_lower_bits(x: u64) -> Self;
fn reduce(x: U64x2) -> Self;
fn reduce_vectored<const N: usize>(
uppers: [U64x2; N],
lowers: [U64x2; N]
) -> [U64x2; N]
where
ArrayUnrolledOps: UnrollableArraySize<N>,
{ ... }
}
Expand description
A GF(2) extension field such that:
Self
isrepr(transparent)
to au64
Self
consists of 63 or fewer bits that are stored in the lower bits of theu64
.- The upper bits of the
u64
are zero.
Safety
All the requirements above must be met when this trait is unsafe impl
’d.
Note that types which implement SmallBinaryField
, do not need to (and probably should not)
implement [bytemuck::Pod
]. This type wraps a POD u64
, but this type has additional
requirements on its set of values, compared to a u64
.
Required Methods
sourcefn from_lower_bits(x: u64) -> Self
fn from_lower_bits(x: u64) -> Self
Produce a field element of Self
by zeroing the upper bits of x
.
Provided Methods
sourcefn reduce_vectored<const N: usize>(
uppers: [U64x2; N],
lowers: [U64x2; N]
) -> [U64x2; N]where
ArrayUnrolledOps: UnrollableArraySize<N>,
fn reduce_vectored<const N: usize>(
uppers: [U64x2; N],
lowers: [U64x2; N]
) -> [U64x2; N]where
ArrayUnrolledOps: UnrollableArraySize<N>,
Reduce the result of several 128-bit carryless multiply operations over
[FiniteField::reduce_multiplication_over()
].