From d9c9ecbf0b79883f682450b9db9742140ef18c1a Mon Sep 17 00:00:00 2001 From: Quentin Bourgerie Date: Wed, 24 Aug 2022 21:43:40 +0200 Subject: [PATCH] fix(manp): Use the active bits to square a the constant in the 2-norm computation to allow more program to be analyzed --- compiler/lib/Dialect/FHE/Analysis/MANP.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/lib/Dialect/FHE/Analysis/MANP.cpp b/compiler/lib/Dialect/FHE/Analysis/MANP.cpp index 85c66b201..b4b02f980 100644 --- a/compiler/lib/Dialect/FHE/Analysis/MANP.cpp +++ b/compiler/lib/Dialect/FHE/Analysis/MANP.cpp @@ -170,9 +170,9 @@ static llvm::APInt APIntWidthExtendUnsignedSq(const llvm::APInt &i) { static llvm::APInt APIntWidthExtendSqForConstant(const llvm::APInt &i) { // Make sure the required number of bits can be represented by the // `unsigned` argument of `zext`. - assert(i.getBitWidth() < 32 && + assert(i.getActiveBits() < 32 && "Square of the constant cannot be represented on 64 bits"); - return llvm::APInt(2 * i.getBitWidth(), + return llvm::APInt(2 * i.getActiveBits(), i.abs().getZExtValue() * i.abs().getZExtValue()); }