Skip to main content

multiversx_bls/
gt.rs

1use crate::bls_api::mclBnGT_isEqual;
2use crate::constants::MCLBN_FP_UNIT_SIZE;
3use crate::init::{INIT, init_library};
4
5/// GT type
6#[derive(Default, Debug, Clone, Copy, Eq)]
7#[repr(C)]
8pub struct GT {
9    d0: [u64; MCLBN_FP_UNIT_SIZE * 4],
10    d1: [u64; MCLBN_FP_UNIT_SIZE * 4],
11    d2: [u64; MCLBN_FP_UNIT_SIZE * 4],
12}
13
14impl PartialEq for GT {
15    /// return true if `self` is equal to `rhs`
16    fn eq(&self, rhs: &Self) -> bool {
17        INIT.call_once(init_library);
18        unsafe { mclBnGT_isEqual(self, rhs) == 1 }
19    }
20}