Skip to content

Commit 8ea9354

Browse files
committed
fix: add correct static_cast for fputil::getpload for bfloat16
Signed-off-by: Krishna Pandey <[email protected]>
1 parent c8f4380 commit 8ea9354

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libc/src/__support/FPUtil/BasicOperations.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,10 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> getpayload(T x) {
354354

355355
return static_cast<T>(payload_dfloat);
356356
} else {
357-
return static_cast<T>(payload);
357+
if constexpr (cpp::is_same_v<T, bfloat16>)
358+
return T(static_cast<int>(payload));
359+
else
360+
return static_cast<T>(payload);
358361
}
359362
}
360363

0 commit comments

Comments
 (0)