|
6 | 6 | // |
7 | 7 | //===----------------------------------------------------------------------===// |
8 | 8 |
|
| 9 | +// ----------------------------------------------------------------------------- |
| 10 | +// **** WARNING **** |
| 11 | +// This file is shared with libc++. You should also be careful when adding |
| 12 | +// dependencies to this file, since it needs to build for all libc++ targets. |
| 13 | +// ----------------------------------------------------------------------------- |
| 14 | + |
9 | 15 | #ifndef LLVM_LIBC_SRC___SUPPORT_STR_TO_FLOAT_H |
10 | 16 | #define LLVM_LIBC_SRC___SUPPORT_STR_TO_FLOAT_H |
11 | 17 |
|
|
32 | 38 | namespace LIBC_NAMESPACE_DECL { |
33 | 39 | namespace internal { |
34 | 40 |
|
| 41 | +// ----------------------------------------------------------------------------- |
| 42 | +// **** WARNING **** |
| 43 | +// This interface is shared with libc++, if you change this interface you need |
| 44 | +// to update it in both libc and libc++. |
| 45 | +// ----------------------------------------------------------------------------- |
35 | 46 | template <class T> struct ExpandedFloat { |
36 | 47 | typename fputil::FPBits<T>::StorageType mantissa; |
37 | 48 | int32_t exponent; |
38 | 49 | }; |
39 | 50 |
|
| 51 | +// ----------------------------------------------------------------------------- |
| 52 | +// **** WARNING **** |
| 53 | +// This interface is shared with libc++, if you change this interface you need |
| 54 | +// to update it in both libc and libc++. |
| 55 | +// ----------------------------------------------------------------------------- |
40 | 56 | template <class T> struct FloatConvertReturn { |
41 | 57 | ExpandedFloat<T> num = {0, 0}; |
42 | 58 | int error = 0; |
@@ -637,6 +653,11 @@ template <> LIBC_INLINE constexpr int32_t get_lower_bound<double>() { |
637 | 653 | return -(309 + 15 + 20); |
638 | 654 | } |
639 | 655 |
|
| 656 | +// ----------------------------------------------------------------------------- |
| 657 | +// **** WARNING **** |
| 658 | +// This interface is shared with libc++, if you change this interface you need |
| 659 | +// to update it in both libc and libc++. |
| 660 | +// ----------------------------------------------------------------------------- |
640 | 661 | // Takes a mantissa and base 10 exponent and converts it into its closest |
641 | 662 | // floating point type T equivalient. First we try the Eisel-Lemire algorithm, |
642 | 663 | // then if that fails then we fall back to a more accurate algorithm for |
@@ -716,6 +737,11 @@ LIBC_INLINE FloatConvertReturn<T> decimal_exp_to_float( |
716 | 737 | return output; |
717 | 738 | } |
718 | 739 |
|
| 740 | +// ----------------------------------------------------------------------------- |
| 741 | +// **** WARNING **** |
| 742 | +// This interface is shared with libc++, if you change this interface you need |
| 743 | +// to update it in both libc and libc++. |
| 744 | +// ----------------------------------------------------------------------------- |
719 | 745 | // Takes a mantissa and base 2 exponent and converts it into its closest |
720 | 746 | // floating point type T equivalient. Since the exponent is already in the right |
721 | 747 | // form, this is mostly just shifting and rounding. This is used for hexadecimal |
|
0 commit comments