aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fp.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fp.cpp b/src/fp.cpp
index 7de679c..65fdc85 100644
--- a/src/fp.cpp
+++ b/src/fp.cpp
@@ -607,7 +607,10 @@ void copyAndMask(Unit *y, const void *x, size_t xByteSize, const Op& op, bool do
if (isGreaterOrEqualArray(y, op.p, op.N)) throw cybozu::Exception("fp:copyAndMask:large x");
return;
}
- maskArray(y, op.N, op.bitSize - 1);
+ maskArray(y, op.N, op.bitSize);
+ if (isGreaterOrEqualArray(y, op.p, op.N)) {
+ maskArray(y, op.N, op.bitSize - 1);
+ }
assert(isLessArray(y, op.p, op.N));
}