From 95a40bb2984b40cebcb6673dc2eaa592fc02acf9 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Mon, 22 Feb 2016 11:09:11 +0900 Subject: [PATCH] rename fullBit to isFullBit --- include/mcl/fp.hpp | 1 + include/mcl/op.hpp | 8 ++++---- src/fp.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/mcl/fp.hpp b/include/mcl/fp.hpp index 707d405..cb95a28 100644 --- a/include/mcl/fp.hpp +++ b/include/mcl/fp.hpp @@ -133,6 +133,7 @@ public: { Gmp::getStr(pstr, op_.mp); } + static inline bool isFullBit() { return op_.isFullBit; } /* binary patter of p @note the value of p is zero diff --git a/include/mcl/op.hpp b/include/mcl/op.hpp index a466455..24007a8 100644 --- a/include/mcl/op.hpp +++ b/include/mcl/op.hpp @@ -80,11 +80,11 @@ struct Op { void3u fp_sub; void3u fp_mul; - bool fullBit; // true if bitSize % uniSize == 0 + bool isFullBit; // true if bitSize % uniSize == 0 /* - same fp_add, fp_sub if fullBit + same fp_add, fp_sub if isFullBit */ - void3u fp_addNC; // assume no carry if !fullBit + void3u fp_addNC; // assume no carry if !isFullBit void3u fp_subNC; // assume x > y // for Montgomery bool useMont; @@ -129,7 +129,7 @@ struct Op { : N(0), bitSize(0) , fp_isZero(0), fp_clear(0), fp_copy(0) , fp_neg(0), fp_sqr(0), fp_add(0), fp_sub(0), fp_mul(0) - , fullBit(true), fp_addNC(0), fp_subNC(0) + , isFullBit(true), fp_addNC(0), fp_subNC(0) , useMont(false), fp_preInv(0) , rp(0), mont(0) , fp_negP(0), fp_sqrPreP(0), fp_invOp(0), fp_addP(0), fp_subP(0), fp_mulPreP(0), fp_modP(0) diff --git a/src/fp.cpp b/src/fp.cpp index 3f11bd5..4cf0309 100644 --- a/src/fp.cpp +++ b/src/fp.cpp @@ -254,7 +254,7 @@ struct OpeFunc { if (mode == FP_LLVM || mode == FP_LLVM_MONT) { \ fp_addP = mcl_fp_add ## n ##S; \ fp_subP = mcl_fp_sub ## n ##S; \ - if (!fullBit) { \ + if (!isFullBit) { \ fp_addNC = mcl_fp_addNC ## n; \ fp_subNC = mcl_fp_subNC ## n; \ } \ @@ -269,7 +269,7 @@ struct OpeFunc { if (n <= 256) { \ fpDbl_addP = mcl_fpDbl_add ## n; \ fpDbl_subP = mcl_fpDbl_sub ## n; \ - if (!fullBit) { \ + if (!isFullBit) { \ fpDbl_addNC = mcl_fp_addNC ## n2; \ fpDbl_subNC = mcl_fp_subNC ## n2; \ } \ @@ -297,7 +297,7 @@ struct OpeFunc { fpDbl_addP = OpeFunc::fpDbl_addPC; \ fpDbl_subP = OpeFunc::fpDbl_subPC; \ } \ - if (fullBit) { \ + if (isFullBit) { \ fp_addNC = fp_add; \ fp_subNC = fp_sub; \ fpDbl_addNC = fpDbl_add; \ @@ -386,7 +386,7 @@ void Op::init(const std::string& mstr, int base, size_t maxBitSize, Mode mode) bool isMinus = fp::strToMpzArray(&bitSize, p, maxBitSize, mp, mstr, base); if (isMinus) throw cybozu::Exception("Op:init:mstr is minus") << mstr; if (mp == 0) throw cybozu::Exception("Op:init:mstr is zero") << mstr; - fullBit = (bitSize % UnitBitSize) == 0; + isFullBit = (bitSize % UnitBitSize) == 0; const size_t roundBit = (bitSize + UnitBitSize - 1) & ~(UnitBitSize - 1); switch (roundBit) {