mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-07 01:06:48 +08:00
Merge pull request #18 from lemire/dlemire/minor_styling
Fixing minor style issues.
This commit is contained in:
commit
4e076c70f9
@ -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);
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
int64_t exponent;
|
||||
uint64_t mantissa;
|
||||
@ -182,7 +166,6 @@ decimal parse_decimal(const char *p, const char *pend) noexcept {
|
||||
decimal answer;
|
||||
answer.num_digits = 0;
|
||||
answer.decimal_point = 0;
|
||||
answer.negative = false;
|
||||
answer.truncated = false;
|
||||
// any whitespace has been skipped.
|
||||
answer.negative = (*p == '-');
|
||||
@ -200,10 +183,9 @@ decimal parse_decimal(const char *p, const char *pend) noexcept {
|
||||
answer.num_digits++;
|
||||
++p;
|
||||
}
|
||||
const char *first_after_period{};
|
||||
if ((p != pend) && (*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(answer.num_digits == 0) {
|
||||
// skip zeros
|
||||
|
||||
@ -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;
|
||||
const static uint16_t number_of_digits_decimal_left_shift_table[65] = {
|
||||
0x0000, 0x0800, 0x0801, 0x0803, 0x1006, 0x1009, 0x100D, 0x1812, 0x1817,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user