std::vector<Node> children;
for (const TNode& current : node)
{
- if (current.getKind() == kind::CONST_BITVECTOR) {
- BitVector value = current.getConst<BitVector>();
+ Node c = current;
+ if (c.getKind() == kind::BITVECTOR_NEG)
+ {
+ isNeg = !isNeg;
+ c = c[0];
+ }
+
+ if (c.getKind() == kind::CONST_BITVECTOR)
+ {
+ BitVector value = c.getConst<BitVector>();
constant = constant * value;
if(constant == BitVector(size, (unsigned) 0)) {
return utils::mkConst(size, 0);
}
- }
- else if (current.getKind() == kind::BITVECTOR_NEG)
- {
- isNeg = !isNeg;
- children.push_back(current[0]);
} else {
- children.push_back(current);
+ children.push_back(c);
}
}
BitVector oValue = BitVector(size, static_cast<unsigned>(1));
if (children.empty())
{
- Assert(!isNeg);
- return utils::mkConst(constant);
+ return utils::mkConst(isNeg ? -constant : constant);
}
std::sort(children.begin(), children.end());
--- /dev/null
+(set-logic QF_BV)
+(set-info :status sat)
+(declare-fun x () (_ BitVec 4))
+
+(assert (= x #b1000))
+
+(assert (= (bvmul (bvneg x) x) #b0000))
+(assert (= (bvmul (bvneg #b0100) #b0100) #b0000))
+(check-sat)