#[repr(C)]pub struct PackedFr {
pub v: [u32; 8],
}Expand description
BN254 scalar field element, 32 bytes, Montgomery form, little-endian 32-bit limbs.
MSL twin: struct Fr { uint v[8]; } in shaders/bn254_fr.metal.
Fields§
§v: [u32; 8]Implementations§
Source§impl PackedFr
impl PackedFr
pub const ZERO: Self
Sourcepub fn from_fr(x: &Fr) -> Self
pub fn from_fr(x: &Fr) -> Self
Montgomery limbs, taken verbatim from arkworks’ internal representation. No conversion happens on either side of the boundary.
Sourcepub fn to_fr(&self) -> Fr
pub fn to_fr(&self) -> Fr
Inverse of Self::from_fr. Uses new_unchecked, which stores the limbs as the
Montgomery representative rather than converting into it. Going through
Fr::from_bigint here instead would multiply by R a second time and every value
would come back wrong by a factor of R.
pub fn pack_slice(xs: &[Fr]) -> Vec<Self>
Sourcepub fn pack_into(xs: &[Fr], out: &mut [Self])
pub fn pack_into(xs: &[Fr], out: &mut [Self])
Packs directly into caller memory. On Metal that pointer is MTLBuffer::contents()
and unified memory makes this the whole upload; on CUDA and WebGPU a transfer still
follows.
Panics if the destination is not exactly as long as the source, because a short destination would leave the tail of a device buffer holding whatever was there before, and a proof built on it would fail verification with no other symptom.
pub fn unpack_slice(xs: &[Self]) -> Vec<Fr> ⓘ
Trait Implementations§
impl Copy for PackedFr
impl Eq for PackedFr
impl Packed for PackedFr
impl StructuralPartialEq for PackedFr
Auto Trait Implementations§
impl Freeze for PackedFr
impl RefUnwindSafe for PackedFr
impl Send for PackedFr
impl Sync for PackedFr
impl Unpin for PackedFr
impl UnsafeUnpin for PackedFr
impl UnwindSafe for PackedFr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more