fix(expr): 修正 not 取反的 const_int 参数顺序(bits 在前)
上一提交 df9a5a9 误把 const_int 参数写成 (value, bits),实际签名为 const_int(pool, bits, val)。改为 const_int(pool, 1, 0)(i1 false),使 not x 真正降级为 (bool(x)==0),不再与 1 比较而恒等。对照本文件 663/680 行的 const_int(pool, 1, 0) 用法可确认参数顺序。
This commit is contained in:
1 parent
9bd3ac3dfb
commit
53ba4e48bd
1 file changed
+1
-1
@@ -791,7 +791,7 @@ novirtual class ExprGenOps(ExprGenBase.ExprGenBase):
|
||||
not_cond: llvmlite.Value* = self.coerce_cond_to_bool(pool, builder, mod, operand, trans)
|
||||
if not_cond is None:
|
||||
return None
|
||||
false_val: llvmlite.Value* = llvmlite.const_int(pool, 0, 1)
|
||||
false_val: llvmlite.Value* = llvmlite.const_int(pool, 1, 0)
|
||||
return llvmlite.build_icmp(builder, llvmlite.ICMP_EQ, not_cond, false_val)
|
||||
elif uo.op == ast.OpKind.Invert:
|
||||
# ~x = x ^ -1
|
||||
|
||||
Reference in new issue
Block a user