This fixes very minor "mistakes". (#1281)

This commit is contained in:
Daniel Lemire 2020-11-02 20:04:04 -05:00 committed by GitHub
parent e6258377d9
commit 6321df078a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -247,11 +247,10 @@ simdjson_warn_unused error_code implementation::minify(const uint8_t *buf, size_
simdjson_warn_unused bool implementation::validate_utf8(const char *buf, size_t len) const noexcept {
const uint8_t *data = (const uint8_t *)buf;
uint64_t pos = 0;
uint64_t next_pos = 0;
uint32_t code_point = 0;
while (pos < len) {
// check of the next 8 bytes are ascii.
next_pos = pos + 16;
uint64_t next_pos = pos + 16;
if (next_pos <= len) { // if it is safe to read 8 more bytes, check that they are ascii
uint64_t v1;
memcpy(&v1, data + pos, sizeof(uint64_t));

View File

@ -64,7 +64,6 @@ decimal parse_decimal(const char *&p) noexcept {
decimal answer;
answer.num_digits = 0;
answer.decimal_point = 0;
answer.negative = false;
answer.truncated = false;
answer.negative = (*p == '-');
if ((*p == '-') || (*p == '+')) {
@ -81,10 +80,9 @@ decimal parse_decimal(const char *&p) noexcept {
answer.num_digits++;
++p;
}
const char *first_after_period{};
if (*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