aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-12-26 13:46:34 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-12-26 13:46:34 +0800
commit23ab1099ce1f8b02511e195b4c3b66cdca7a0f00 (patch)
tree50d2603fcae7170ed1157e533f275f44f98a07a7
parent389bb658ef48e597d27d9940a8cfe43314ab8f7c (diff)
downloadtangerine-mcl-23ab1099ce1f8b02511e195b4c3b66cdca7a0f00.tar.gz
tangerine-mcl-23ab1099ce1f8b02511e195b4c3b66cdca7a0f00.tar.zst
tangerine-mcl-23ab1099ce1f8b02511e195b4c3b66cdca7a0f00.zip
verify max value in comment
-rw-r--r--src/low_func.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/low_func.hpp b/src/low_func.hpp
index 2f8c4a0..1cab20e 100644
--- a/src/low_func.hpp
+++ b/src/low_func.hpp
@@ -543,6 +543,17 @@ struct Mont {
}
}
} else {
+ /*
+ R = 1 << 64
+ L % 64 = 63 ; not full bit
+ F = 1 << (L + 1)
+ max p = (1 << L) - 1
+ x, y <= p - 1
+ max x * y[0], p * q <= ((1 << L) - 1)(R - 1)
+ t = x * y[i] + p * q <= 2((1 << L) - 1)(R - 1) = (F - 2)(R - 1)
+ t >> 64 <= (F - 2)(R - 1)/R = (F - 2) - (F - 2)/R
+ t + (t >> 64) = (F - 2)R - (F - 2)/R < FR
+ */
Unit carry;
(void)carry;
Unit buf[N * 2 + 1];