1#include "include/llvm-libc-macros/float16-macros.h"
2#include "include/llvm-libc-types/float128.h"
3
4#ifndef LIBC_TYPES_HAS_FLOAT16
5#error unsupported
6#endif
7
8_Float16 cvt_from_float(float x) { return static_cast<_Float16>(x); }
9
10_Float16 cvt_from_double(double x) { return static_cast<_Float16>(x); }
11
12_Float16 cvt_from_long_double(long double x) {
13 return static_cast<_Float16>(x);
14}
15
16#ifdef LIBC_TYPES_HAS_FLOAT128
17_Float16 cvt_from_float128(float128 x) { return static_cast<_Float16>(x); }
18#endif
19
20float cvt_to_float(_Float16 x) { return x; }
21
22double cvt_to_double(_Float16 x) { return x; }
23
24long double cvt_to_long_double(_Float16 x) { return x; }
25
26#ifdef LIBC_TYPES_HAS_FLOAT128
27float128 cvt_to_float128(_Float16 x) { return x; }
28#endif
29
30extern "C" void _start() {}
31

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of libc/cmake/modules/compiler_features/check_float16_conversion.cpp