Audacity 3.2.0
Functions
fast_float::detail Namespace Reference

Functions

constexpr fastfloat_really_inline int32_t power (int32_t q) noexcept
 
template<typename T >
from_chars_result parse_infnan (const char *first, const char *last, T &value) noexcept
 

Function Documentation

◆ parse_infnan()

template<typename T >
from_chars_result fast_float::detail::parse_infnan ( const char *  first,
const char *  last,
T &  value 
)
noexcept

Special case +inf, -inf, nan, infinity, -infinity. The case comparisons could be made much faster given that we know that the strings a null-free and fixed.

Definition at line 2857 of file fast_float.h.

2857 {
2858 from_chars_result answer;
2859 answer.ptr = first;
2860 answer.ec = std::errc(); // be optimistic
2861 bool minusSign = false;
2862 if (*first == '-') { // assume first < last, so dereference without checks; C++17 20.19.3.(7.1) explicitly forbids '+' here
2863 minusSign = true;
2864 ++first;
2865 }
2866 if (last - first >= 3) {
2867 if (fastfloat_strncasecmp(first, "nan", 3)) {
2868 answer.ptr = (first += 3);
2869 value = minusSign ? -std::numeric_limits<T>::quiet_NaN() : std::numeric_limits<T>::quiet_NaN();
2870 // Check for possible nan(n-char-seq-opt), C++17 20.19.3.7, C11 7.20.1.3.3. At least MSVC produces nan(ind) and nan(snan).
2871 if(first != last && *first == '(') {
2872 for(const char* ptr = first + 1; ptr != last; ++ptr) {
2873 if (*ptr == ')') {
2874 answer.ptr = ptr + 1; // valid nan(n-char-seq-opt)
2875 break;
2876 }
2877 else if(!(('a' <= *ptr && *ptr <= 'z') || ('A' <= *ptr && *ptr <= 'Z') || ('0' <= *ptr && *ptr <= '9') || *ptr == '_'))
2878 break; // forbidden char, not nan(n-char-seq-opt)
2879 }
2880 }
2881 return answer;
2882 }
2883 if (fastfloat_strncasecmp(first, "inf", 3)) {
2884 if ((last - first >= 8) && fastfloat_strncasecmp(first + 3, "inity", 5)) {
2885 answer.ptr = first + 8;
2886 } else {
2887 answer.ptr = first + 3;
2888 }
2889 value = minusSign ? -std::numeric_limits<T>::infinity() : std::numeric_limits<T>::infinity();
2890 return answer;
2891 }
2892 }
2893 answer.ec = std::errc::invalid_argument;
2894 return answer;
2895}
bool fastfloat_strncasecmp(const char *input1, const char *input2, size_t length)
Definition: fast_float.h:193
STL namespace.

References fast_float::from_chars_result::ec, fast_float::fastfloat_strncasecmp(), and fast_float::from_chars_result::ptr.

Referenced by fast_float::from_chars_advanced().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ power()

constexpr fastfloat_really_inline int32_t fast_float::detail::power ( int32_t  q)
constexprnoexcept

For q in (0,350), we have that f = (((152170 + 65536) * q ) >> 16); is equal to floor(p) + q where p = log(5**q)/log(2) = q * log(5)/log(2)

For negative values of q in (-400,0), we have that f = (((152170 + 65536) * q ) >> 16); is equal to -ceil(p) + q where p = log(5**-q)/log(2) = -q * log(5)/log(2)

Definition at line 1454 of file fast_float.h.

1454 {
1455 return (((152170 + 65536) * q) >> 16) + 63;
1456 }

Referenced by fast_float::add_native(), SpectrumAnalyst::Calculate(), SpecCache::CalculateOneSpectrum(), EffectNoiseReduction::Worker::Classify(), fast_float::compute_error_scaled(), fast_float::compute_float(), anonymous_namespace{SpectrumCache.cpp}::ComputeSpectrumUsingRealFFTf(), fast_float::binary_format< T >::exact_power_of_ten(), SpecCache::Populate(), and FormantShifter::Process().

Here is the caller graph for this function: