mirror of
https://github.com/data61/MP-SPDZ.git
synced 2026-01-09 13:37:58 -05:00
Fix bugs in binary circuit inputs.
This commit is contained in:
@@ -99,7 +99,7 @@ template<class U>
|
||||
void GC::Processor<T>::check_input(const U& in, const int* params)
|
||||
{
|
||||
int n_bits = *params;
|
||||
auto test = in >> (n_bits - 1);
|
||||
auto test = in >> n_bits;
|
||||
if (n_bits == 1)
|
||||
{
|
||||
if (not (in == 0 or in == 1))
|
||||
@@ -110,7 +110,7 @@ void GC::Processor<T>::check_input(const U& in, const int* params)
|
||||
if (params[1] == 0)
|
||||
throw runtime_error(
|
||||
"input out of range for a " + std::to_string(n_bits)
|
||||
+ "-bit signed integer: " + to_string(in));
|
||||
+ "-bit (un)signed integer: " + to_string(in));
|
||||
else
|
||||
throw runtime_error(
|
||||
"input out of range for a " + to_string(n_bits)
|
||||
|
||||
@@ -159,8 +159,11 @@ void Processor<T>::inputb(typename T::Input& input, ProcessorBase& input_process
|
||||
for (int i = 0; i < DIV_CEIL(x.n_bits, dl); i++)
|
||||
{
|
||||
auto& res = S[x.dest + i];
|
||||
res.my_input(input, bigint(whole_input >> (i * dl)).get_si(),
|
||||
res.my_input(input,
|
||||
(whole_input > 0) ?
|
||||
whole_input.get_ui() : whole_input.get_si(),
|
||||
min(dl, x.n_bits - i * dl));
|
||||
whole_input >>= dl;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user