From 93024e94b87c8a1d60ae7da438d4e76bc9ed9c49 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Tue, 1 Nov 2016 10:31:00 +0900 Subject: [PATCH] don't call AddUnitPre if not necessary --- src/fp_proto.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fp_proto.hpp b/src/fp_proto.hpp index 73fc272..6c54a74 100644 --- a/src/fp_proto.hpp +++ b/src/fp_proto.hpp @@ -146,7 +146,10 @@ struct MulPre { c -= SubPre::f(tmp, tmp, z + N); // c:tmp[N] = ad + bc c += AddPre::f(z + H, z + H, tmp); - AddUnitPre::f(z + N + H, H, c); + assert(c <= 1); + if (c) { + AddUnitPre::f(z + N + H, H, 1); + } } static inline void func(Unit *z, const Unit *x, const Unit *y) {