From e7554ccbfd9160c49f69feeb18295e0366703ee4 Mon Sep 17 00:00:00 2001 From: Marcel Keller Date: Wed, 20 Nov 2024 14:16:10 +1100 Subject: [PATCH] Fix bug in emulation of splitting. --- Protocols/FakeShare.hpp | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/Protocols/FakeShare.hpp b/Protocols/FakeShare.hpp index 19e08143f..adfd51e9e 100644 --- a/Protocols/FakeShare.hpp +++ b/Protocols/FakeShare.hpp @@ -19,32 +19,24 @@ void FakeShare::split(StackedVector& dest, int start = k * unit; int m = min(unit, n_inputs - start); - switch (regs.size() / n_bits) - { - case 3: - { - for (int i = 0; i < n_bits; i++) - for (int j = 1; j < 3; j++) - dest.at(regs.at(3 * i + j) + k) = {}; + int n_split = regs.size() / n_bits; + for (int i = 0; i < n_bits; i++) + for (int j = 1; j < n_split; j++) + dest.at(regs.at(n_split * i + j) + k) = {}; - square64 square; + square64 square; - for (int j = 0; j < m; j++) - { - square.rows[j] = (source[j + start]).get_limb(0); - } + for (int j = 0; j < m; j++) + { + square.rows[j] = (source[j + start]).get_limb(0); + } - square.transpose(m, n_bits); + square.transpose(m, n_bits); - for (int j = 0; j < n_bits; j++) - { - auto& dest_reg = dest.at(regs.at(3 * j) + k); - dest_reg = square.rows[j]; - } - break; - } - default: - not_implemented(); + for (int j = 0; j < n_bits; j++) + { + auto& dest_reg = dest.at(regs.at(n_split * j) + k); + dest_reg = square.rows[j]; } } }