1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#![allow(non_snake_case)]

pub mod wrappers;

use std::fmt;
use big::wrappers::*;
use fp2::wrappers::*;

impl FP2 {
    pub fn from_BIGs(w: &mut FP2, x: &BIG, y: &BIG) {
        unsafe {
            FP2_from_BIGs(w, x, y);
        }
    }
}

impl PartialEq for FP2 {
    fn eq(&self, other: &FP2) -> bool {
        return (self.a == other.a) &&
            (self.b == other.b);
    }
}

impl Copy for FP2 { }

impl Clone for FP2 {
    fn clone(&self) -> FP2 {
        FP2 {
            a: self.a,
            b: self.b
        }
    }
}

impl fmt::Display for FP2 {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "FP2: [ {}, {} ]", self.a, self.b)
    }
}

impl fmt::Debug for FP2 {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "FP2: [ {}, {} ]", self.a, self.b)
    }
}