| 638 | |
| 639 | template<af_op_t op> |
| 640 | static af_err af_bitwise(af_array *out, const af_array lhs, const af_array rhs, |
| 641 | const bool batchMode) { |
| 642 | try { |
| 643 | const af_dtype type = implicit(lhs, rhs); |
| 644 | |
| 645 | const ArrayInfo &linfo = getInfo(lhs); |
| 646 | const ArrayInfo &rinfo = getInfo(rhs); |
| 647 | |
| 648 | dim4 odims = getOutDims(linfo.dims(), rinfo.dims(), batchMode); |
| 649 | |
| 650 | if (odims.ndims() == 0) { |
| 651 | return af_create_handle(out, 0, nullptr, type); |
| 652 | } |
| 653 | |
| 654 | af_array res; |
| 655 | switch (type) { |
| 656 | case s32: res = bitOp<int, op>(lhs, rhs, odims); break; |
| 657 | case u32: res = bitOp<uint, op>(lhs, rhs, odims); break; |
| 658 | case s8: res = bitOp<schar, op>(lhs, rhs, odims); break; |
| 659 | case u8: res = bitOp<uchar, op>(lhs, rhs, odims); break; |
| 660 | case b8: res = bitOp<char, op>(lhs, rhs, odims); break; |
| 661 | case s64: res = bitOp<intl, op>(lhs, rhs, odims); break; |
| 662 | case u64: res = bitOp<uintl, op>(lhs, rhs, odims); break; |
| 663 | case s16: res = bitOp<short, op>(lhs, rhs, odims); break; |
| 664 | case u16: res = bitOp<ushort, op>(lhs, rhs, odims); break; |
| 665 | default: TYPE_ERROR(0, type); |
| 666 | } |
| 667 | |
| 668 | std::swap(*out, res); |
| 669 | } |
| 670 | CATCHALL; |
| 671 | return AF_SUCCESS; |
| 672 | } |
| 673 | |
| 674 | af_err af_bitand(af_array *out, const af_array lhs, const af_array rhs, |
| 675 | const bool batchMode) { |
nothing calls this directly
no test coverage detected