pub fn read_g2<E: Engine>(
    mmap: &Mmap,
    start: usize,
    end: usize,
    checked: bool,
) -> Result<E::G2Affine, std::io::Error> {
    let ptr = &mmap[start..end];
    // Safety: this operation is safe, because it's simply
    // casting to a known struct at the correct offset, given
    // the structure of the on-disk data.
    let repr =
        unsafe { *(ptr as *const [u8] as *const <E::G2Affine as CurveAffine>::Uncompressed) };

    if checked {
        repr.into_affine()
    } else {
        repr.into_affine_unchecked()
    }
    .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
    .and_then(|e| {
        if e.is_zero() {
            Err(io::Error::new(
                io::ErrorKind::InvalidData,
                "point at infinity",
            ))
        } else {
            Ok(e)
        }
    })
}
// A re-usable method for parameter loading via mmap.  Unlike the
// internal ones used elsewhere, this one does not update offset state
// and simply does the cast and transform needed.
A re-usable method for parameter loading via mmap.  Unlike the
internal ones used elsewhere, this one does not update offset state
and simply does the cast and transform needed.
A re - usable method for parameter loading via mmap . Unlike the internal ones used elsewhere this one does not update offset state and simply does the cast and transform needed .
pub fn read_g2<E: Engine>(
    mmap: &Mmap,
    start: usize,
    end: usize,
    checked: bool,
) -> Result<E::G2Affine, std::io::Error> {
    let ptr = &mmap[start..end];
    // Safety: this operation is safe, because it's simply
    // casting to a known struct at the correct offset, given
    // the structure of the on-disk data.
    let repr =
        unsafe { *(ptr as *const [u8] as *const <E::G2Affine as CurveAffine>::Uncompressed) };
    if checked {
        repr.into_affine()
    } else {
        repr.into_affine_unchecked()
    }
    .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
    .and_then(|e| {
        if e.is_zero() {
            Err(io::Error::new(
                io::ErrorKind::InvalidData,
                "point at infinity",
            ))
        } else {
            Ok(e)
        }
    })
}
pub fn read_g2 < E : Engine > ( mmap : & Mmap , start : usize , end : usize , checked : bool , ) -> Result < E :: G2Affine , std :: io :: Error > { let ptr = & mmap [ start .. end ] ; // Safety: this operation is safe, because it's simply // casting to a known struct at the correct offset, given // the structure of the on-disk data. let repr = unsafe { * ( ptr as * const [ u8 ] as * const < E :: G2Affine as CurveAffine > :: Uncompressed ) } ; if checked { repr . into_affine ( ) } else { repr . into_affine_unchecked ( ) } . map_err ( | e | io :: Error :: new ( io :: ErrorKind :: InvalidData , e ) ) . and_then ( | e | { if e . is_zero ( ) { Err ( io :: Error :: new ( io :: ErrorKind :: InvalidData , " " , ) ) } else { Ok ( e ) } } ) }
A re-usable method for parameter loading via mmap.
A re - usable method for parameter loading via mmap .
mmap
&Mmap
start
usize
end
usize
checked
bool
mmap
&Mmap
start
usize
end
usize
checked
bool