From 87911a0ee2516a39d766318b26f96b9f7cc9c80b Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 16 Aug 2023 15:01:47 +0900 Subject: [PATCH] tweak --- include/mcl/invmod.hpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/include/mcl/invmod.hpp b/include/mcl/invmod.hpp index a4fb4d81..5182e41b 100644 --- a/include/mcl/invmod.hpp +++ b/include/mcl/invmod.hpp @@ -83,24 +83,26 @@ void mulUnit(SintT&z, const SintT& x, INT y) z.sign = x.sign ^ (y < 0); } -template -struct InvModT { - typedef SintT Sint; #if MCL_SIZEOF_UNIT == 4 - typedef int32_t INT; - static const int modL = 30; +typedef int32_t INT; +static const int modL = 30; #else - typedef int64_t INT; - static const int modL = 62; +typedef int64_t INT; +static const int modL = 62; #endif - static const INT modN = INT(1) << modL; - static const INT half = modN / 2; - static const INT MASK = modN - 1; +static const INT modN = INT(1) << modL; +static const INT half = modN / 2; +static const INT MASK = modN - 1; + +struct Quad { + INT u, v, q, r; +}; + +template +struct InvModT { + typedef SintT Sint; Sint M; INT Mi; - struct Quad { - INT u, v, q, r; - }; void init(const mpz_class& mM) { toSint(M, mM);