From 06101859afe17b1a4ca04c63720d4eeca2d4dcd4 Mon Sep 17 00:00:00 2001 From: Maths <644311798@qq.com> Date: Wed, 20 Dec 2023 10:16:16 +0800 Subject: [PATCH] Update mpint_field and arg_kv (#175) * Update mpint_field.cc * Update arg_kv.h * Update arg_kv.h * Update arg_kv.cc * Update arg_kv.h --- yacl/math/galois_field/mpint_field/mpint_field.cc | 1 - yacl/utils/spi/argument/arg_kv.cc | 4 ++-- yacl/utils/spi/argument/arg_kv.h | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/yacl/math/galois_field/mpint_field/mpint_field.cc b/yacl/math/galois_field/mpint_field/mpint_field.cc index fae3dc9d..9e5f9b80 100644 --- a/yacl/math/galois_field/mpint_field/mpint_field.cc +++ b/yacl/math/galois_field/mpint_field/mpint_field.cc @@ -87,7 +87,6 @@ void MPIntField::NegInplace(MPInt *x) const { WEAK_ENFORCE(IsInField(*x), "x is not a valid field element, x={}", *x); x->NegateInplace(); AddInplace(x, mod_); - x->DecrOne(); } MPInt MPIntField::Inv(const MPInt &x) const { return x.InvertMod(mod_); } diff --git a/yacl/utils/spi/argument/arg_kv.cc b/yacl/utils/spi/argument/arg_kv.cc index 4662c703..1075893c 100644 --- a/yacl/utils/spi/argument/arg_kv.cc +++ b/yacl/utils/spi/argument/arg_kv.cc @@ -20,12 +20,12 @@ const std::string& SpiArg::Key() const { return key_; } bool SpiArg::HasValue() const { return value_.has_value(); } -SpiArg SpiArg::operator=(const char* value) { +SpiArg& SpiArg::operator=(const char* value) { value_ = absl::AsciiStrToLower(std::string(value)); return *this; } -SpiArg SpiArg::operator=(const std::string& value) { +SpiArg& SpiArg::operator=(const std::string& value) { value_ = absl::AsciiStrToLower(value); return *this; } diff --git a/yacl/utils/spi/argument/arg_kv.h b/yacl/utils/spi/argument/arg_kv.h index 5a7e10c5..9e3bc5a6 100644 --- a/yacl/utils/spi/argument/arg_kv.h +++ b/yacl/utils/spi/argument/arg_kv.h @@ -39,14 +39,14 @@ class SpiArg { } template - SpiArg operator=(const T &value) { + SpiArg &operator=(const T &value) { value_ = value; return *this; } // Specialized functions of operator= - SpiArg operator=(const char *value); - SpiArg operator=(const std::string &value); + SpiArg &operator=(const char *value); + SpiArg &operator=(const std::string &value); const std::string &Key() const; bool HasValue() const;