Bug#996702: fp16: libfp16 fails to build for i386
Package: fp16
Severity: normal
Tags: patch upstream
Dear Maintainer,
the function fp16_ieee_from_fp32_value() fails to pass tests on i386 arch,
resulting in missing packages https://buildd.debian.org/status/package.php?p=fp16
I think the problem here is implicit usage of double type at include/fp16/fp16.h:231.
The patch should fix that.
Index: fp16/include/fp16/fp16.h
===================================================================
--- fp16.orig/include/fp16/fp16.h
+++ fp16/include/fp16/fp16.h
@@ -228,7 +228,8 @@ static inline uint16_t fp16_ieee_from_fp
const float scale_to_inf = fp32_from_bits(UINT32_C(0x77800000));
const float scale_to_zero = fp32_from_bits(UINT32_C(0x08800000));
#endif
- float base = (fabsf(f) * scale_to_inf) * scale_to_zero;
+ const volatile float base_inf = fabsf(f) * scale_to_inf;
+ float base = base_inf * scale_to_zero;
const uint32_t w = fp32_to_bits(f);
const uint32_t shl1_w = w + w;
Reply to: