Fixing minor style issues.

This commit is contained in:
Daniel Lemire 2020-11-02 14:55:17 -05:00
parent 48c017aa96
commit 83154a24ad
2 changed files with 2 additions and 20 deletions

View File

@ -35,22 +35,6 @@ fastfloat_really_inline bool is_made_of_eight_digits_fast(const char *chars) no
return is_made_of_eight_digits_fast(val); return is_made_of_eight_digits_fast(val);
} }
fastfloat_really_inline uint32_t parse_four_digits_unrolled(const char *chars) noexcept {
uint32_t val;
::memcpy(&val, chars, sizeof(uint32_t));
val = (val & 0x0F0F0F0F) * 2561 >> 8;
return (val & 0x00FF00FF) * 6553601 >> 16;
}
fastfloat_really_inline bool is_made_of_four_digits_fast(const char *chars) noexcept {
uint32_t val;
::memcpy(&val, chars, 4);
return (((val & 0xF0F0F0F0) |
(((val + 0x06060606) & 0xF0F0F0F0) >> 4)) ==
0x33333333);
}
struct parsed_number_string { struct parsed_number_string {
int64_t exponent; int64_t exponent;
uint64_t mantissa; uint64_t mantissa;
@ -176,7 +160,6 @@ decimal parse_decimal(const char *p, const char *pend) noexcept {
decimal answer; decimal answer;
answer.num_digits = 0; answer.num_digits = 0;
answer.decimal_point = 0; answer.decimal_point = 0;
answer.negative = false;
answer.truncated = false; answer.truncated = false;
// any whitespace has been skipped. // any whitespace has been skipped.
answer.negative = (*p == '-'); answer.negative = (*p == '-');
@ -194,10 +177,9 @@ decimal parse_decimal(const char *p, const char *pend) noexcept {
answer.num_digits++; answer.num_digits++;
++p; ++p;
} }
const char *first_after_period{};
if ((p != pend) && (*p == '.')) { if ((p != pend) && (*p == '.')) {
++p; ++p;
first_after_period = p; const char *first_after_period = p;
// if we have not yet encountered a zero, we have to skip it as well // if we have not yet encountered a zero, we have to skip it as well
if(answer.num_digits == 0) { if(answer.num_digits == 0) {
// skip zeros // skip zeros

View File

@ -30,7 +30,7 @@ inline void trim(decimal &h) {
uint32_t number_of_digits_decimal_left_shift(decimal &h, uint32_t shift) { uint32_t number_of_digits_decimal_left_shift(const decimal &h, uint32_t shift) {
shift &= 63; shift &= 63;
const static uint16_t number_of_digits_decimal_left_shift_table[65] = { const static uint16_t number_of_digits_decimal_left_shift_table[65] = {
0x0000, 0x0800, 0x0801, 0x0803, 0x1006, 0x1009, 0x100D, 0x1812, 0x1817, 0x0000, 0x0800, 0x0801, 0x0803, 0x1006, 0x1009, 0x100D, 0x1812, 0x1817,