Lines Matching refs:buffer
519 bool ToHexString(char* buffer, int buffer_size) const;
592 static uint64_t ReadUInt64(Vector<const char> buffer,
597 int digit = buffer[i] - '0';
1018 bool Bignum::ToHexString(char* buffer, int buffer_size) const {
1026 buffer[0] = '0';
1027 buffer[1] = '\0';
1035 buffer[string_index--] = '\0';
1038 buffer[string_index--] = '0';
1044 buffer[string_index--] = HexCharOfValue(current_bigit & 0xF);
1051 buffer[string_index--] = HexCharOfValue(most_significant_bigit & 0xF);
1393 Vector<char> buffer, int* length);
1397 Vector<char>(buffer), int* length);
1401 Vector<char>(buffer), int* length);
1405 Vector<char> buffer, int* length, int* decimal_point) {
1425 buffer[0] = '\0';
1450 is_even, buffer, length);
1455 buffer, length);
1460 buffer, length);
1465 buffer[*length] = '\0';
1471 Vector<char> buffer, int* length) {
1481 buffer[(*length)++] = static_cast<char>(digit + '0');
1511 ASSERT(buffer[(*length) - 1] != '9');
1512 buffer[(*length) - 1]++;
1514 if ((buffer[(*length) - 1] - '0') % 2 == 0) {
1517 ASSERT(buffer[(*length) - 1] != '9');
1518 buffer[(*length) - 1]++;
1526 ASSERT(buffer[(*length) -1] != '9');
1527 buffer[(*length) - 1]++;
1535 Vector<char> buffer, int* length) {
1542 buffer[i] = static_cast<char>(digit + '0');
1552 buffer[count - 1] = static_cast<char>(digit + '0');
1555 if (buffer[i] != '0' + 10) break;
1556 buffer[i] = '0';
1557 buffer[i - 1]++;
1559 if (buffer[0] == '0' + 10) {
1560 buffer[0] = '1';
1568 Vector<char>(buffer), int* length)
1579 buffer[0] = '1';
1590 buffer, length);
1733 Vector<char> buffer,
1740 static bool RoundWeed(Vector<char> buffer, int length,
1750 (rest + ten_kappa < small_distance || // buffer{-1} > w_high
1752 buffer[length - 1]--;
1766 static bool RoundWeedCounted(Vector<char> buffer, int length,
1779 buffer[length - 1]++;
1781 if (buffer[i] != '0' + 10) break;
1782 buffer[i] = '0';
1783 buffer[i - 1]++;
1785 if (buffer[0] == '0' + 10) {
1786 buffer[0] = '1';
1814 static bool DigitGen(DiyFp low, DiyFp w, DiyFp high, Vector<char> buffer,
1839 buffer[*length] = static_cast<char>('0' + digit);
1848 return RoundWeed(buffer, *length, DiyFp::Minus(too_high, w).f(),
1866 buffer[*length] = static_cast<char>('0' + digit);
1871 return RoundWeed(buffer, *length, DiyFp::Minus(too_high, w).f() * unit,
1877 static bool DigitGenCounted(DiyFp w, int requested_digits, Vector<char> buffer,
1898 buffer[*length] = static_cast<char>('0' + digit);
1910 return RoundWeedCounted(buffer, *length, rest,
1925 buffer[*length] = static_cast<char>('0' + digit);
1932 return RoundWeedCounted(buffer, *length, fractionals, one.f(), w_error,
1936 static bool Grisu3(double v, FastDtoaMode mode, Vector<char> buffer,
1971 buffer, length, &kappa);
1976 static bool Grisu3Counted(double v, int requested_digits, Vector<char> buffer,
1999 buffer, length, &kappa);
2008 Vector<char> buffer,
2018 result = Grisu3(v, mode, buffer, length, &decimal_exponent);
2022 buffer, length, &decimal_exponent);
2029 buffer[*length] = '\0';
2120 Vector<char> buffer, int* length) {
2122 buffer[(*length) + i] = '0' + number % 10;
2129 static void FillDigits32(uint32_t number, Vector<char> buffer, int* length) {
2135 buffer[(*length) + number_length] = static_cast<char>('0' + digit);
2142 char tmp = buffer[i];
2143 buffer[i] = buffer[j];
2144 buffer[j] = tmp;
2153 Vector<char> buffer, int* length) {
2161 FillDigits32FixedLength(part0, 3, buffer, length);
2162 FillDigits32FixedLength(part1, 7, buffer, length);
2163 FillDigits32FixedLength(part2, 7, buffer, length);
2167 static void FillDigits64(uint64_t number, Vector<char> buffer, int* length) {
2176 FillDigits32(part0, buffer, length);
2177 FillDigits32FixedLength(part1, 7, buffer, length);
2178 FillDigits32FixedLength(part2, 7, buffer, length);
2180 FillDigits32(part1, buffer, length);
2181 FillDigits32FixedLength(part2, 7, buffer, length);
2183 FillDigits32(part2, buffer, length);
2188 static void RoundUp(Vector<char> buffer, int* length, int* decimal_point) {
2189 // An empty buffer represents 0.
2191 buffer[0] = '1';
2197 buffer[(*length) - 1]++;
2199 if (buffer[i] != '0' + 10) {
2202 buffer[i] = '0';
2203 buffer[i - 1]++;
2206 if (buffer[0] == '0' + 10) {
2207 buffer[0] = '1';
2213 int fractional_count, Vector<char> buffer,
2227 buffer[*length] = static_cast<char>('0' + digit);
2233 RoundUp(buffer, length, decimal_point);
2246 buffer[*length] = static_cast<char>('0' + digit);
2250 RoundUp(buffer, length, decimal_point);
2258 static void TrimZeros(Vector<char> buffer, int* length, int* decimal_point) {
2259 while (*length > 0 && buffer[(*length) - 1] == '0') {
2263 while (first_non_zero < *length && buffer[first_non_zero] == '0') {
2268 buffer[i - first_non_zero] = buffer[i];
2278 Vector<char> buffer,
2306 FillDigits32(quotient, buffer, length);
2307 FillDigits64FixedLength(remainder, buffer, length);
2312 FillDigits64(significand, buffer, length);
2318 FillDigits64(integrals, buffer, length);
2320 FillDigits32(static_cast<uint32_t>(integrals), buffer, length);
2324 buffer, length, decimal_point);
2329 buffer[0] = '\0';
2335 buffer, length, decimal_point);
2337 TrimZeros(buffer, length, decimal_point);
2338 buffer[*length] = '\0';
2354 static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) {
2355 for (int i = 0; i < buffer.length(); i++) {
2356 if (buffer[i] != '0') {
2357 return buffer.SubVector(i, buffer.length());
2360 return Vector<const char>(buffer.start(), 0);
2364 static Vector<const char> TrimTrailingZeros(Vector<const char> buffer) {
2365 for (int i = buffer.length() - 1; i >= 0; --i) {
2366 if (buffer[i] != '0') {
2367 return buffer.SubVector(0, i + 1);
2370 return Vector<const char>(buffer.start(), 0);
2374 static void CutToMaxSignificantDigits(Vector<const char> buffer,
2379 significant_buffer[i] = buffer[i];
2382 ASSERT(buffer[buffer.length() - 1] != '0');
2386 exponent + (buffer.length() - kMaxSignificantDecimalDigits);
2389 static void TrimAndCut(Vector<const char> buffer, int exponent,
2392 Vector<const char> left_trimmed = TrimLeadingZeros(buffer);
2408 static uint64_t ReadUint64(Vector<const char> buffer,
2412 while (i < buffer.length() && result <= (kMaxUint64 / 10 - 1)) {
2413 int digit = buffer[i++] - '0';
2421 static void ReadDiyFp(Vector<const char> buffer,
2425 uint64_t significand = ReadUint64(buffer, &read_digits);
2426 if (buffer.length() == read_digits) {
2431 if (buffer[read_digits] >= '5') {
2437 *remaining_decimals = buffer.length() - read_digits;
2460 static bool DiyFpStrtod(Vector<const char> buffer,
2465 ReadDiyFp(buffer, &input, &remaining_decimals);
2492 if (kMaxUint64DecimalDigits - buffer.length() >= adjustment_exponent) {
2549 static int CompareBufferWithDiyFp(Vector<const char> buffer,
2552 ASSERT(buffer.length() + exponent <= kMaxDecimalPower + 1);
2553 ASSERT(buffer.length() + exponent > kMinDecimalPower);
2554 ASSERT(buffer.length() <= kMaxSignificantDecimalDigits);
2559 buffer_bignum.AssignDecimalString(buffer);
2599 double Strtod(Vector<const char> buffer, int exponent)
2604 TrimAndCut(buffer, exponent, copy_buffer, kMaxSignificantDecimalDigits,
2690 // The result should be interpreted as buffer * 10^(point-length).
2694 char* buffer,
2756 double StringToDouble(const char* buffer,
2821 char buffer[kMaxExponentLength + 1];
2822 buffer[kMaxExponentLength] = '\0';
2825 buffer[--first_char_pos] = '0' + (exponent % 10);
2828 result.append(&buffer[first_char_pos],
3068 char* buffer, int buffer_length,
3071 Vector<char> vector(buffer, buffer_length);
3308 char buffer[kBufferSize]; // NOLINT: size is known at compile time.
3411 // Copy significant digits of the integer part (if any) to the buffer.
3415 buffer[buffer_pos++] = static_cast<char>(*current);
3417 // Will later check if it's an octal in the buffer.
3463 buffer[buffer_pos++] = static_cast<char>(*current);
3550 char* start = buffer;
3552 buffer + buffer_pos,
3563 buffer[buffer_pos++] = '1';
3568 buffer[buffer_pos] = '\0';
3570 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent);
3577 const char* buffer,
3580 return StringToIeee(buffer, length, processed_characters_count);