From e6bb40a8382697511d2cf8408f71734f48c3b7e3 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 15 Jan 2020 15:15:43 +0900 Subject: [PATCH] add Fp::setArrayMod --- include/mcl/fp.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/mcl/fp.hpp b/include/mcl/fp.hpp index 9303ddc..c9b1002 100644 --- a/include/mcl/fp.hpp +++ b/include/mcl/fp.hpp @@ -330,6 +330,7 @@ public: } /* mode = Mod : set x mod p if sizeof(S) * n <= 64 else error + set array x as little endian */ template void setArray(bool *pb, const S *x, size_t n, mcl::fp::MaskMode mode = fp::NoMask) @@ -346,6 +347,15 @@ public: fp::copyAndMask(v_, x, sizeof(S) * n, op_, fp::MaskAndMod); toMont(); } + /* + set (array mod p) + error if sizeof(S) * n > 64 + */ + template + void setArrayMod(bool *pb, const S *x, size_t n) + { + setArray(pb, x, n, fp::Mod); + } /* mask x with (1 << (bitLen - 1)) - 1 if x >= p