MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_bitwise

Function af_bitwise

src/api/c/binary.cpp:640–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

638
639template<af_op_t op>
640static 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
674af_err af_bitand(af_array *out, const af_array lhs, const af_array rhs,
675 const bool batchMode) {

Callers

nothing calls this directly

Calls 6

implicitFunction · 0.85
getOutDimsFunction · 0.85
swapFunction · 0.85
af_create_handleFunction · 0.70
dimsMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected