This PR changes the central GATEs data structure from the notorious GATE* m_pGates C array into a std::vector<GATE> m_vGates in the ABYParty class.
Since ABYParty as well as all specific sharing type classes (descendants of the Circuit class) used the m_pGates pointer directly, I changed all those pointers into a reference std::vector<GATE>& m_vGates. Note that prior to this change, the array was fixed for the whole lifetime of the ABYCircuit class, so it was safe to access the pointer directly. The underlying array of the vector wrapper may change if the vector grows, so at some places I had to change the access to a cleaner &m_vGates[...] access and couldn't just initialize m_pGates with m_vGates.data().
The upside is that we don't need to know the circuit size in advance but the vector just grows as needed. However, the vector will by default reserve space for 2^16 gates on initialization. This reservation can be controlled as the last argument of the ABYParty contructor. It was maxgates before, which is not necessary any more.
This PR changes the central
GATE
s data structure from the notoriousGATE* m_pGates
C array into astd::vector<GATE> m_vGates
in theABYParty
class. SinceABYParty
as well as all specific sharing type classes (descendants of theCircuit
class) used them_pGates
pointer directly, I changed all those pointers into a referencestd::vector<GATE>& m_vGates
. Note that prior to this change, the array was fixed for the whole lifetime of theABYCircuit
class, so it was safe to access the pointer directly. The underlying array of thevector
wrapper may change if the vector grows, so at some places I had to change the access to a cleaner&m_vGates[...]
access and couldn't just initializem_pGates
withm_vGates.data()
.The upside is that we don't need to know the circuit size in advance but the vector just grows as needed. However, the vector will by default reserve space for 2^16 gates on initialization. This reservation can be controlled as the last argument of the
ABYParty
contructor. It wasmaxgates
before, which is not necessary any more.