ClifHouck commented on code in PR #40067:
URL: https://github.com/apache/arrow/pull/40067#discussion_r1514918457


##########
cpp/src/arrow/compute/kernels/scalar_cast_internal.cc:
##########
@@ -56,6 +93,36 @@ struct CastPrimitive<OutType, InType, 
enable_if_t<std::is_same<OutType, InType>:
   }
 };
 
+// Cast int to half float
+template<typename InType>
+struct CastPrimitive<HalfFloatType, InType, enable_if_integer<InType>> {
+   static void Exec(const ArraySpan& arr, ArraySpan* out) {
+        using InT = typename InType::c_type;
+        const InT* in_values = arr.GetValues<InT>(1);
+        uint16_t* out_values = out->GetValues<uint16_t>(1);
+        for (int64_t i = 0; i < arr.length; ++i) {
+          float temp = static_cast<float>(*in_values++);
+          *out_values++ = Float16(temp).bits();
+        }
+   }
+};
+
+// Cast half float to int
+template<typename OutType>
+struct CastPrimitive<OutType, HalfFloatType, enable_if_integer<OutType>> {
+   static void Exec(const ArraySpan& arr, ArraySpan* out) {
+        std::cout << "HalfFloat to Int CastPrimitive()!\n";

Review Comment:
   Need to remove this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to