我编写以下Z3 python代码
x, y = Ints('x y')
F = (x == y & 16) # x has the value of (y & 16)
print F
Run Code Online (Sandbox Code Playgroud)
但我得到了以下错误:
TypeError: unsupported operand type(s) for &: 'instance' and 'int'
Run Code Online (Sandbox Code Playgroud)
如何在Z3方程中进行按位运算(在这种情况下)?
谢谢.
x并且y应该是位向量:
x, y = BitVecs('x y', 32)
F = (x == y & 16) # x has the value of (y & 16)
print F
Run Code Online (Sandbox Code Playgroud)
请参阅http://rise4fun.com/Z3/tutorial/guide下的"Bitvectors"部分