coord.cpp revision e4369b05aaa20df73a37f4d319ce456865cc74f3
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * @brief Conversion between Coord and strings
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * Krzysztof KosiĆski <tweenk.pl@gmail.com>
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * Copyright 2014 Authors
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * This library is free software; you can redistribute it and/or
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * modify it either under the terms of the GNU Lesser General Public
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * License version 2.1 as published by the Free Software Foundation
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * (the "LGPL") or, at your option, under the terms of the Mozilla
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * Public License Version 1.1 (the "MPL"). If you do not alter this
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * notice, a recipient may use your version of this file under either
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * the MPL or the LGPL.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * You should have received a copy of the LGPL along with this library
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * in the file COPYING-LGPL-2.1; if not, write to the Free Software
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * You should have received a copy of the MPL along with this library
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * in the file COPYING-MPL-1.1
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * The contents of this file are subject to the Mozilla Public License
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * Version 1.1 (the "License"); you may not use this file except in
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering * compliance with the License. You may obtain a copy of the License at
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
25300b5a1fcf54674a69d0f4ab08925be00b0227Lennart Poettering * OF ANY KIND, either express or implied. See the LGPL or the MPL for
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering * the specific language governing rights and limitations.
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering// Most of the code in this file is derived from:
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering// https://code.google.com/p/double-conversion/
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// The copyright notice for that code is attached below.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// Copyright 2010 the V8 project authors. All rights reserved.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// Redistribution and use in source and binary forms, with or without
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// modification, are permitted provided that the following conditions are
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// * Redistributions of source code must retain the above copyright
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// notice, this list of conditions and the following disclaimer.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// * Redistributions in binary form must reproduce the above
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// copyright notice, this list of conditions and the following
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// disclaimer in the documentation and/or other materials provided
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// with the distribution.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// * Neither the name of Google Inc. nor the names of its
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// contributors may be used to endorse or promote products derived
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// from this software without specific prior written permission.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define UINT64_2PART_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering ((sizeof(a) / sizeof(*(a))) / \
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering void operator=(const TypeName&)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define DOUBLE_CONVERSION_UNUSED __attribute__((unused))
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringinline int StrLength(const char* string) {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering ASSERT(length == static_cast<size_t>(static_cast<int>(length)));
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringtemplate <typename T>
72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9Lennart Poettering Vector(T* data, int length) : start_(data), length_(length) {
72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9Lennart Poettering ASSERT(length == 0 || (length > 0 && data != NULL));
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering return Vector<T>(start() + from, to - from);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering bool is_empty() const { return length_ == 0; }
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering T& operator[](int index) const {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering T& last() { return start_[length_ - 1]; }
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringinline Dest BitCast(const Source& source) {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering return BitCast<Dest>(reinterpret_cast<uintptr_t>(source));
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// We assume that doubles and uint64_t have the same endianness.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringstatic uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); }
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringstatic double uint64_to_double(uint64_t d64) { return BitCast<double>(d64); }
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering// This "Do It Yourself Floating Point" class
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering DiyFp(uint64_t f, int e) : f_(f), e_(e) {}
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static DiyFp Minus(const DiyFp& a, const DiyFp& b) {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering // By adding 1U << 31 to tmp we round the final result.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering // Halfway cases will be round up.
72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9Lennart Poettering uint64_t result_f = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static DiyFp Times(const DiyFp& a, const DiyFp& b) {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering const uint64_t k10MSBits = UINT64_2PART_C(0xFFC00000, 00000000);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering while ((f & k10MSBits) == 0) {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering while ((f & kUint64MSB) == 0) {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering int e() const { return e_; }
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering void set_f(uint64_t new_value) { f_ = new_value; }
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering void set_e(int new_value) { e_ = new_value; }
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static const uint64_t kUint64MSB = UINT64_2PART_C(0x80000000, 00000000);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static const uint64_t kSignMask = UINT64_2PART_C(0x80000000, 00000000);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static const uint64_t kExponentMask = UINT64_2PART_C(0x7FF00000, 00000000);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static const uint64_t kSignificandMask = UINT64_2PART_C(0x000FFFFF, FFFFFFFF);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static const uint64_t kHiddenBit = UINT64_2PART_C(0x00100000, 00000000);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static const int kPhysicalSignificandSize = 52; // Excludes the hidden bit.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering explicit Double(double d) : d64_(double_to_uint64(d)) {}
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering explicit Double(uint64_t d64) : d64_(d64) {}
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering // The current double could be a denormal.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering while ((f & kHiddenBit) == 0) {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering // Do the final shifts in one go.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering f <<= DiyFp::kSignificandSize - kSignificandSize;
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering e -= DiyFp::kSignificandSize - kSignificandSize;
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering double NextDouble() const {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering if (d64_ == kInfinity) return Double(kInfinity).value();
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering double PreviousDouble() const {
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering if (d64_ == (kInfinity | kSignMask)) return -Double::Infinity();
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering if (IsDenormal()) return kDenormalExponent;
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering static_cast<int>((d64 & kExponentMask) >> kPhysicalSignificandSize);
if (!IsDenormal()) {
return significand;
bool IsDenormal() const {
bool IsSpecial() const {
bool IsNan() const {
bool IsInfinite() const {
int Sign() const {
if (LowerBoundaryIsCloser()) {
bool LowerBoundaryIsCloser() const {
return kSignificandSize;
static double Infinity() {
static double NaN() {
exponent++;
return kInfinity;
exponent--;
biased_exponent = 0;
class Bignum {
Bignum()
for (int i = 0; i < kBigitCapacity; ++i) {
bigits_[i] = 0;
Zero();
if (value == 0) return;
Zero();
if (value == 0) return;
for (int i = 0; i < needed_bigits; ++i) {
Clamp();
bigits_[i] = 0;
void Square();
return Compare(a, b) == 0;
return Compare(a, b) <= 0;
return Compare(a, b) < 0;
return PlusCompare(a, b, c) == 0;
return PlusCompare(a, b, c) <= 0;
return PlusCompare(a, b, c) < 0;
UNREACHABLE();
void Clamp();
bool IsClamped() const;
void Zero();
int used_digits_;
int exponent_;
int from,
int digits_to_read) {
return result;
Zero();
int pos = 0;
Clamp();
static int HexCharValue(char c) {
Zero();
for (int j = 0; j <= string_index; ++j) {
if (most_significant_bigit != 0) {
used_digits_++;
Clamp();
if (operand == 0) return;
bigit_pos++;
while (carry != 0) {
bigit_pos++;
while (borrow != 0) {
Clamp();
if (used_digits_ == 0) return;
if (factor == 0) {
Zero();
if (used_digits_ == 0) return;
for (int i = 0; i < used_digits_; ++i) {
while (carry != 0) {
used_digits_++;
if (factor == 0) {
Zero();
for (int i = 0; i < used_digits_; ++i) {
while (carry != 0) {
used_digits_++;
if (exponent == 0) return;
if (used_digits_ == 0) return;
if (remaining_exponent > 0) {
for (int i = 0; i < used_digits_; ++i) {
for (int i = 0; i < used_digits_; ++i) {
int bigit_index1 = i;
int bigit_index2 = 0;
while (bigit_index1 >= 0) {
bigit_index1--;
bigit_index2++;
bigit_index1--;
bigit_index2++;
Clamp();
if (power_exponent == 0) {
Zero();
int shifts = 0;
shifts++;
int bit_size = 0;
while (tmp_base != 0) {
bit_size++;
bool delayed_multipliciation = false;
if (high_bits_zero) {
delayed_multipliciation = true;
if (delayed_multipliciation) {
while (mask != 0) {
Square();
Clamp();
return result;
return result;
result++;
return result;
int result = 0;
while (number != 0) {
result++;
return result;
if (used_digits_ == 0) {
for (int i = 0; i < exponent_; ++i) {
for (int j = 0; j < kHexCharsPerBigit; ++j) {
for (int j = 0; j < kHexCharsPerBigit; ++j) {
while (most_significant_bigit != 0) {
return PlusCompare(b, a, c);
if (borrow == 0) return 0;
used_digits_--;
if (used_digits_ == 0) {
exponent_ = 0;
for (int i = 0; i < used_digits_; ++i) {
bigits_[i] = 0;
used_digits_ = 0;
exponent_ = 0;
for (int i = 0; i < zero_digits; ++i) {
bigits_[i] = 0;
for (int i = 0; i < used_digits_; ++i) {
if (carry != 0) {
used_digits_++;
for (int i = 0; i < factor; ++i) {
if (borrow == 0) return;
Clamp();
class PowersOfTenCache {
static const int kDecimalExponentDistance;
static const int kMinDecimalExponent;
static const int kMaxDecimalExponent;
int max_exponent,
int* decimal_exponent);
int* found_exponent);
struct CachedPower {
int min_exponent,
int max_exponent,
int* decimal_exponent) {
int index =
int* found_exponent) {
int index =
enum BignumDtoaMode {
return exponent;
int exponent,
bool lower_boundary_is_closer,
int estimated_power,
bool need_boundary_deltas,
int* decimal_point,
bool is_even,
ASSERT(v > 0);
int exponent;
bool lower_boundary_is_closer;
bool need_boundary_deltas =
*length = 0;
switch (mode) {
case BIGNUM_DTOA_SHORTEST:
case BIGNUM_DTOA_FIXED:
case BIGNUM_DTOA_PRECISION:
UNREACHABLE();
bool is_even,
*length = 0;
bool in_delta_room_minus;
bool in_delta_room_plus;
if (is_even) {
if (is_even) {
if (compare < 0) {
} else if (compare > 0) {
} else if (in_delta_room_minus) {
digit++;
(*decimal_point)++;
*length = 0;
(*decimal_point)++;
*length = 0;
static void InitialScaledStartValuesPositiveExponent(
if (need_boundary_deltas) {
if (need_boundary_deltas) {
if (need_boundary_deltas) {
if (need_boundary_deltas) {
int exponent,
bool lower_boundary_is_closer,
int estimated_power,
bool need_boundary_deltas,
if (exponent >= 0) {
} else if (estimated_power >= 0) {
int* decimal_point,
bool in_range;
if (is_even) {
if (in_range) {
enum FastDtoaMode {
bool FastDtoa(double d,
int requested_digits,
int* length,
int* decimal_point);
int* kappa)
static unsigned int const kSmallPowersOfTen[] =
int number_bits,
int* exponent_plus_one) {
*length = 0;
while (*kappa > 0) {
(*length)++;
(*kappa)--;
(*length)++;
(*kappa)--;
*length = 0;
while (*kappa > 0) {
(*length)++;
(*kappa)--;
if (requested_digits == 0) break;
if (requested_digits == 0) {
kappa);
(*length)++;
(*kappa)--;
if (requested_digits != 0) return false;
kappa);
int kappa;
return result;
int kappa;
return result;
bool FastDtoa(double v,
int requested_digits,
int* length,
int* decimal_point) {
ASSERT(v > 0);
bool result = false;
int decimal_exponent = 0;
switch (mode) {
case FAST_DTOA_SHORTEST:
case FAST_DTOA_PRECISION:
UNREACHABLE();
if (result) {
return result;
class UInt128 {
if (shift_amount == 0) {
low_bits_ = 0;
high_bits_ = 0;
} else if (shift_amount <= 0) {
return result;
high_bits_ = 0;
return result;
bool IsZero() const {
int number_length = 0;
while (number != 0) {
int i = *length;
if (part0 != 0) {
} else if (part1 != 0) {
if (*length == 0) {
(*decimal_point)++;
for (int i = 0; i < fractional_count; ++i) {
if (fractionals == 0) break;
point--;
(*length)++;
for (int i = 0; i < fractional_count; ++i) {
point--;
(*length)++;
(*length)--;
int first_non_zero = 0;
if (first_non_zero != 0) {
bool FastFixedDtoa(double v,
int fractional_count,
int* length,
int* decimal_point) {
*length = 0;
} else if (exponent >= 0) {
*length = 0;
*decimal_point = 0;
if ((*length) == 0) {
int exponent,
char* significant_buffer,
int* significant_exponent) {
int* number_of_read_digits) {
*number_of_read_digits = i;
return result;
int* remaining_decimals) {
int read_digits;
*remaining_decimals = 0;
significand++;
int exponent = 0;
switch (exponent) {
UNREACHABLE();
int exponent,
double* result) {
int remaining_decimals;
int precision_digits_count =
int exponent,
if (exponent >= 0) {
if (diy_fp.e() > 0) {
double* guess)
int updated_exponent;
double guess;
if (comparison < 0) {
return guess;
} else if (comparison > 0) {
return guess;
class DoubleToStringConverter {
enum Flags {
NO_FLAGS = 0,
const char* infinity_symbol,
const char* nan_symbol,
char exponent_character,
int requested_digits,
int requested_digits,
int precision,
enum DtoaMode {
static void DoubleToAscii(double v,
int requested_digits,
char* buffer,
int buffer_length,
bool* sign,
int* length,
int* point);
int length,
int exponent,
int length,
int decimal_point,
int digits_after_point,
const int flags_;
const char* const infinity_symbol_;
const char* const nan_symbol_;
const char exponent_character_;
const int decimal_in_shortest_low_;
const int decimal_in_shortest_high_;
class StringToDoubleConverter {
enum Flags {
NO_FLAGS = 0,
double empty_string_value,
double junk_string_value,
const char* infinity_symbol,
const char* nan_symbol)
int length,
int* processed_characters_count) const;
const int flags_;
const double empty_string_value_;
const double junk_string_value_;
const char* const infinity_symbol_;
const char* const nan_symbol_;
int length,
int* processed_characters_count) const;
double value,
if (value < 0) {
const char* decimal_digits,
int length,
int exponent,
if (exponent < 0) {
if (exponent == 0) {
while (exponent > 0) {
const char* decimal_digits,
int length,
int decimal_point,
int digits_after_point,
if (decimal_point <= 0) {
if (digits_after_point > 0) {
if (digits_after_point > 0) {
if (digits_after_point == 0) {
double value,
int decimal_point;
bool sign;
int decimal_rep_length;
result);
int requested_digits,
int decimal_point;
bool sign;
const int kDecimalRepCapacity =
int decimal_rep_length;
double value,
int requested_digits,
int decimal_point;
bool sign;
int decimal_rep_length;
int precision,
int decimal_point;
bool sign;
int decimal_rep_length;
result);
result);
switch (dtoa_mode) {
UNREACHABLE();
*sign = true;
*sign = false;
*length = 0;
bool fast_worked;
switch (mode) {
case SHORTEST:
case FIXED:
case PRECISION:
fast_worked = false;
UNREACHABLE();
if (fast_worked) return;
template <class Iterator>
const char* substring) {
++*current;
++*current;
static bool isWhitespace(int x) {
for (int i = 0; i < kWhitespaceTable7Length; i++) {
if (kWhitespaceTable7[i] == x) return true;
template <class Iterator>
++*current;
bool* result_is_junk)
*result_is_junk = true;
++(*current);
*result_is_junk = false;
int exponent = 0;
int digit;
return junk_string_value;
if (overflow != 0) {
bool zero_tail = true;
++(*current);
return junk_string_value;
exponent++;
++(*current);
*result_is_junk = false;
if (exponent == 0) {
if (sign) {
const char *input,
int length,
int* processed_characters_count) const {
return empty_string_value_;
return junk_string_value_;
int buffer_pos = 0;
int exponent = 0;
int significant_digits = 0;
int insignificant_digits = 0;
bool nonzero_digit_dropped = false;
bool sign = false;
++current;
return junk_string_value_;
return junk_string_value_;
return junk_string_value_;
return junk_string_value_;
return junk_string_value_;
return junk_string_value_;
return junk_string_value_;
bool leading_zero = false;
++current;
leading_zero = true;
++current;
bool result_is_junk;
end,
sign,
if (!result_is_junk) {
return result;
++current;
++current;
if (significant_digits == 0) {
octal = false;
++current;
return junk_string_value_;
goto parsing_done;
if (significant_digits == 0) {
++current;
exponent--;
++current;
return junk_string_value_;
++current;
if (allow_trailing_junk) {
goto parsing_done;
return junk_string_value_;
++current;
if (allow_trailing_junk) {
goto parsing_done;
return junk_string_value_;
if (allow_trailing_junk) {
goto parsing_done;
return junk_string_value_;
int num = 0;
++current;
return junk_string_value_;
return junk_string_value_;
if (allow_trailing_spaces) {
if (octal) {
double result;
bool result_is_junk;
sign,
return result;
if (nonzero_digit_dropped) {
exponent--;
const char* buffer,
int length,
int* processed_characters_count) const {
bool sign;
if (sign) {
if (exponent == 0) {
if (exponent < 0) {
return ret;
return ret;
int dummy;