fix(manp): Use the active bits to square a the constant in the 2-norm computation to allow more program to be analyzed

This commit is contained in:
Quentin Bourgerie
2022-08-24 21:43:40 +02:00
parent 46a914e181
commit d9c9ecbf0b

View File

@@ -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());
}