From cad8cfdf5740bc8d4f99d83c5f24a303e2738720 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Thu, 7 Jan 2021 18:01:57 -0500 Subject: [PATCH] Removing dead code. --- include/fast_float/parse_number.h | 66 ------------------------------- 1 file changed, 66 deletions(-) diff --git a/include/fast_float/parse_number.h b/include/fast_float/parse_number.h index 3677174..f69b741 100644 --- a/include/fast_float/parse_number.h +++ b/include/fast_float/parse_number.h @@ -131,72 +131,6 @@ from_chars_result from_chars(const char *first, const char *last, return answer; } -template -from_chars_result odlfrom_chars(const char *first, const char *last, - T &value, chars_format fmt /*= chars_format::general*/) noexcept { - static_assert (std::is_same::value || std::is_same::value, "only float and double are supported"); - - - from_chars_result answer; - while ((first != last) && fast_float::is_space(uint8_t(*first))) { - first++; - } - if (first == last) { - answer.ec = std::errc::invalid_argument; - answer.ptr = first; - return answer; - } - parsed_number_string pns = parse_number_string(first, last, fmt); - if (!pns.valid) { - return parse_infnan(first, last, value); - } - answer.ec = std::errc(); // be optimistic - answer.ptr = pns.lastmatch; - adjusted_mantissa am; - // Most times, we have pns.too_many_digits = false. - if(pns.too_many_digits) { - // Uncommon path where we have too many digits. - // - // credit: R. Oudompheng who first implemented this fast path. - // It does the job of accelerating the slow path since most - // long streams of digits are determined after 19 digits. - // Note that mantissa+1 cannot overflow since mantissa < 10**19 and so - // mantissa+1 <= 10**19 < 2**64. - adjusted_mantissa am1 = compute_float>(pns.exponent, pns.mantissa); - adjusted_mantissa am2 = compute_float>(pns.exponent, pns.mantissa+1); - // They must both agree and be both a successful result. - if(( am1 == am2 ) && (am1.power2 >= 0)) { - am = am1; - } else { - // long way! (uncommon) - decimal d = parse_decimal(first, last); - am = compute_float>(d); - } - to_float(pns.negative, am, value); - } else { - // We are entering the common path where the number of digits is no more than 19. - // - // Next is Clinger's fast path. - if (binary_format::min_exponent_fast_path() <= pns.exponent && pns.exponent <= binary_format::max_exponent_fast_path() && pns.mantissa <=binary_format::max_mantissa_fast_path()) { - value = T(pns.mantissa); - if (pns.exponent < 0) { value = value / binary_format::exact_power_of_ten(-pns.exponent); } - else { value = value * binary_format::exact_power_of_ten(pns.exponent); } - if (pns.negative) { value = -value; } - return answer; - } - // Then we have our main routine. - am = compute_float>(pns.exponent, pns.mantissa); - // If we called compute_float>(pns.exponent, pns.mantissa) and we have an invalid power (am.power2 < 0), - // then we need to go the long way around again. This is very uncommon. - if(am.power2 < 0) { // long way! (uncommon) - decimal d = parse_decimal(first, last); - am = compute_float>(d); - } - to_float(pns.negative, am, value); - } - return answer; -} - } // namespace fast_float #endif