提交 90c06f14 authored 作者: Frederic Bastien's avatar Frederic Bastien

fix identity and associative flag of some scalar.

上级 1bee17f9
...@@ -821,9 +821,9 @@ class BinaryBitOp(BinaryScalarOp): ...@@ -821,9 +821,9 @@ class BinaryBitOp(BinaryScalarOp):
return [None, None] return [None, None]
class OR(BinaryBitOp): class OR(BinaryBitOp):
identity = False identity = 0
commutative = True commutative = True
associative = False associative = True
def impl(self, x, y): def impl(self, x, y):
return x | y return x | y
def c_code(self, node, name, (x, y), (z, ), sub): def c_code(self, node, name, (x, y), (z, ), sub):
...@@ -831,9 +831,9 @@ class OR(BinaryBitOp): ...@@ -831,9 +831,9 @@ class OR(BinaryBitOp):
or_ = OR() or_ = OR()
class XOR(BinaryBitOp): class XOR(BinaryBitOp):
identity = False identity = 0
commutative = True commutative = True
associative = False associative = True
def impl(self, x, y): def impl(self, x, y):
return x ^ y return x ^ y
def c_code(self, node, name, (x, y), (z, ), sub): def c_code(self, node, name, (x, y), (z, ), sub):
...@@ -841,9 +841,9 @@ class XOR(BinaryBitOp): ...@@ -841,9 +841,9 @@ class XOR(BinaryBitOp):
xor = XOR() xor = XOR()
class AND(BinaryBitOp): class AND(BinaryBitOp):
identity = False identity = 1
commutative = True commutative = True
associative = False associative = True
def impl(self, x, y): def impl(self, x, y):
return x & y return x & y
def c_code(self, node, name, (x, y), (z, ), sub): def c_code(self, node, name, (x, y), (z, ), sub):
...@@ -851,7 +851,6 @@ class AND(BinaryBitOp): ...@@ -851,7 +851,6 @@ class AND(BinaryBitOp):
and_ = AND() and_ = AND()
class Invert(UnaryBitOp): class Invert(UnaryBitOp):
identity = False
def impl(self, x): def impl(self, x):
return ~x return ~x
def c_code(self, node, name, (x,), (z, ), sub): def c_code(self, node, name, (x,), (z, ), sub):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论