diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2016-11-01 13:52:46 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2016-11-01 13:52:46 +0800 |
commit | 298e9a91cb95085a61dc3f04b892b82ada6e1e2e (patch) | |
tree | 30d4e9b366afa7a690857e879e21a3319f26e9a6 | |
parent | a92e6acf7ee6475c16d154ec4c81e72c4351c464 (diff) | |
download | dexon-mcl-298e9a91cb95085a61dc3f04b892b82ada6e1e2e.tar.gz dexon-mcl-298e9a91cb95085a61dc3f04b892b82ada6e1e2e.tar.zst dexon-mcl-298e9a91cb95085a61dc3f04b892b82ada6e1e2e.zip |
alternative of mpn_add_1
-rw-r--r-- | src/fp_proto.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/fp_proto.hpp b/src/fp_proto.hpp index cd59e39..6b538d7 100644 --- a/src/fp_proto.hpp +++ b/src/fp_proto.hpp @@ -56,7 +56,18 @@ template<class Tag = Gtag> struct AddUnitPre { static inline Unit func(Unit *x, Unit n, Unit y) { +#if 0 + Unit t = x[0] + y; + if (t >= y) return 0; + for (size_t i = 1; i < n; i++) { + t = x[i] + 1; + x[i] = t; + if (t != 0) return 0; + } + return 1; +#else return mpn_add_1((mp_limb_t*)x, (const mp_limb_t*)x, (int)n, y); +#endif } static const u1uII f; }; |