Lines Matching full:this
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.
34 // This interface is shared with libc++, if you change this interface you need
37 // This is used in both this file and in the main str_to_float.h.
38 // TODO: Figure out where to put this.
41 // This is based on the HPD data structure described as part of the Simple
42 // Decimal Conversion algorithm by Nigel Tao, described at this link:
46 // This precomputed table speeds up left shifts by having the number of new
50 // This table was generated by the script at
117 // accumulator, minus the number of bits needed to represent the base (in this
134 static_cast<uint32_t>(round_to_digit) >= this->num_digits) {
139 // are zero. In that case, if the rounding mode is up, then this number
150 if (this->digits[round_to_digit] == 5 &&
151 static_cast<uint32_t>(round_to_digit + 1) == this->num_digits) {
155 if (this->truncated) {
159 // If this exactly halfway, round to even.
163 return this->digits[round_to_digit - 1] % 2 != 0;
167 return this->digits[round_to_digit] >= 5;
178 if (digit_index >= this->num_digits) {
181 if (this->digits[digit_index] !=
184 ((this->digits[digit_index] <
196 while (this->num_digits > 0 && this->digits[this->num_digits - 1] == 0) {
197 --this->num_digits;
199 if (this->num_digits == 0) {
200 this->decimal_point = 0;
204 // Perform a digitwise binary non-rounding right shift on this value by
221 if (read_index < this->num_digits) {
222 read_digit = this->digits[read_index];
230 this->decimal_point -= read_index - 1;
234 while (read_index < this->num_digits) {
235 uint64_t read_digit = this->digits[read_index];
238 this->digits[write_index] = static_cast<uint8_t>(write_digit);
250 this->digits[write_index] = static_cast<uint8_t>(write_digit);
253 this->truncated = true;
257 this->num_digits = write_index;
258 this->trim_trailing_zeroes();
261 // Perform a digitwise binary non-rounding left shift on this value by
265 uint32_t new_digits = this->get_num_new_digits(shift_amount);
267 int32_t read_index = this->num_digits - 1;
268 uint32_t write_index = this->num_digits + new_digits;
278 accumulator += static_cast<uint64_t>(this->digits[read_index])
284 this->digits[write_index] = static_cast<uint8_t>(write_digit);
286 this->truncated = true;
299 this->digits[write_index] = static_cast<uint8_t>(write_digit);
301 this->truncated = true;
306 this->num_digits += new_digits;
307 if (this->num_digits > MAX_NUM_DIGITS) {
308 this->num_digits = MAX_NUM_DIGITS;
310 this->decimal_point += new_digits;
311 this->trim_trailing_zeroes();
323 // This counts the digits in the number, even if there isn't space to store
332 this->decimal_point = total_digits;
335 if (num_string[num_cur] == '0' && this->num_digits == 0) {
336 --this->decimal_point;
341 if (this->num_digits < MAX_NUM_DIGITS) {
342 this->digits[this->num_digits] = static_cast<uint8_t>(
344 ++this->num_digits;
346 this->truncated = true;
353 this->decimal_point = total_digits;
367 // Here we do this operation as int64 to avoid overflow.
368 int64_t temp_exponent = static_cast<int64_t>(this->decimal_point) +
378 this->decimal_point = static_cast<int32_t>(temp_exponent);
382 this->trim_trailing_zeroes();
393 this->left_shift(MAX_SHIFT_AMOUNT);
396 this->left_shift(shift_amount);
401 this->right_shift(MAX_SHIFT_AMOUNT);
404 this->right_shift(-shift_amount);
409 // This is done ignoring overflow.
416 while (static_cast<int32_t>(cur_digit) < this->decimal_point &&
417 cur_digit < this->num_digits) {
418 result = result * 10 + (this->digits[cur_digit]);
423 while (static_cast<int32_t>(cur_digit) < this->decimal_point) {
428 this->should_round_up(this->decimal_point, round));
433 LIBC_INLINE uint8_t *get_digits() { return this->digits; }
434 LIBC_INLINE uint32_t get_num_digits() { return this->num_digits; }
435 LIBC_INLINE int32_t get_decimal_point() { return this->decimal_point; }
436 LIBC_INLINE void set_truncated(bool trunc) { this->truncated = trunc; }