forked from data61/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gate.h
42 lines (31 loc) · 746 Bytes
/
Gate.h
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
#ifndef __GATE_H__
#define __GATE_H__
#include <string>
#include <iostream>
#include <stdio.h>
#include "Key.h"
#include "common.h"
#define NO_LAYER (-1)
class Gate {
public:
wire_id_t _left;
wire_id_t _right;
wire_id_t _out;
Function _func;
int _layer;
Gate() : _left(-1), _right(-1), _out(-1), _layer(-1) {}
inline void init(wire_id_t left, wire_id_t right, wire_id_t out,std::string func) {
_left = left;
_right = right;
_out = out;
_func = func;
_layer = NO_LAYER;
}
inline uint8_t func(uint8_t left, uint8_t right) {
return _func[2*left+right];
}
void print(int id) {
printf ("gate %d: l:%lu, r:%lu, o:%lu, func:%d%d%d%d\n", id, _left, _right, _out, _func[0], _func[1], _func[2], _func[3] );
}
};
#endif