Skip to content

Commit

Permalink
Merge branch 'master' of ssh://gitlab.tiker.net/inducer/pyopencl
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Dec 15, 2017
2 parents 055e033 + 6ef146c commit bbcac4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions pyopencl/array.py
Expand Up @@ -1138,6 +1138,8 @@ def __iand__(self, other):
self.add_event(
self._scalar_binop(self, self, other, op="&"))

return self

def __ior__(self, other):
common_dtype = _get_common_dtype(self, other, self.queue)

Expand All @@ -1150,6 +1152,8 @@ def __ior__(self, other):
self.add_event(
self._scalar_binop(self, self, other, op="|"))

return self

def __ixor__(self, other):
common_dtype = _get_common_dtype(self, other, self.queue)

Expand All @@ -1162,6 +1166,8 @@ def __ixor__(self, other):
self.add_event(
self._scalar_binop(self, self, other, op="^"))

return self

def _zero_fill(self, queue=None, wait_for=None):
queue = queue or self.queue

Expand Down
7 changes: 5 additions & 2 deletions test/test_array.py
Expand Up @@ -552,14 +552,17 @@ def test_bitwise(ctx_factory):

for op in [o.iand, o.ior, o.ixor]:
res_dev = a_dev.copy()
op(res_dev, b_dev)
op_res = op(res_dev, b_dev)
assert op_res is res_dev

res = a.copy()
op(res, b)

assert (res_dev.get() == res).all()

res_dev = a_dev.copy()
op(res_dev, s)
op_res = op(res_dev, s)
assert op_res is res_dev
res = a.copy()
op(res, s)

Expand Down

0 comments on commit bbcac4f

Please sign in to comment.