@@ -259,17 +259,36 @@ def __imod__(self, other):
259
259
return _ufunc_impl .remainder (self , asarray (other ), out = self )
260
260
261
261
262
+ # bitwise ops
263
+ # and, self & other
264
+ def __and__ (self , other ):
265
+ return _ufunc_impl .bitwise_and (self , asarray (other ))
262
266
267
+ def __rand__ (self , other ):
268
+ return _ufunc_impl .bitwise_and (self , asarray (other ))
263
269
264
- # FIXME ops and binops below
270
+ def __iand__ (self , other ):
271
+ return _ufunc_impl .bitwise_and (self , asarray (other ), out = self )
265
272
273
+ # or, self | other
266
274
def __or__ (self , other ):
267
- other_tensor = asarray (other ).get ()
268
- return asarray (self ._tensor .__or__ (other_tensor ))
275
+ return _ufunc_impl .bitwise_or (self , asarray (other ))
276
+
277
+ def __ror__ (self , other ):
278
+ return _ufunc_impl .bitwise_or (self , asarray (other ))
269
279
270
280
def __ior__ (self , other ):
271
- other_tensor = asarray (other ).get ()
272
- return asarray (self ._tensor .__ior__ (other_tensor ))
281
+ return _ufunc_impl .bitwise_or (self , asarray (other ), out = self )
282
+
283
+ # xor, self ^ other
284
+ def __xor__ (self , other ):
285
+ return _ufunc_impl .bitwise_xor (self , asarray (other ))
286
+
287
+ def __rxor__ (self , other ):
288
+ return _ufunc_impl .bitwise_xor (self , asarray (other ))
289
+
290
+ def __ixor__ (self , other ):
291
+ return _ufunc_impl .bitwise_xor (self , asarray (other ), out = self )
273
292
274
293
275
294
# unary ops
0 commit comments