| 771 | |
| 772 | template <typename OutType> |
| 773 | void AddCommonNumberCasts(const std::shared_ptr<DataType>& out_ty, CastFunction* func) { |
| 774 | AddCommonCasts(out_ty->id(), out_ty, func); |
| 775 | |
| 776 | // Cast from boolean to number |
| 777 | DCHECK_OK(func->AddKernel(Type::BOOL, {boolean()}, out_ty, |
| 778 | CastFunctor<OutType, BooleanType>::Exec)); |
| 779 | |
| 780 | // Cast from other strings |
| 781 | for (const std::shared_ptr<DataType>& in_ty : BaseBinaryTypes()) { |
| 782 | auto exec = GenerateVarBinaryBase<CastFunctor, OutType>(*in_ty); |
| 783 | DCHECK_OK(func->AddKernel(in_ty->id(), {in_ty}, out_ty, exec)); |
| 784 | } |
| 785 | for (const std::shared_ptr<DataType>& in_ty : BinaryViewTypes()) { |
| 786 | auto exec = GenerateVarBinaryViewBase<CastFunctor, OutType>(*in_ty); |
| 787 | DCHECK_OK(func->AddKernel(in_ty->id(), {in_ty}, out_ty, exec)); |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | template <typename OutType> |
| 792 | std::shared_ptr<CastFunction> GetCastToInteger(std::string name) { |
nothing calls this directly
no test coverage detected