It still works.

This commit is contained in:
Daniel Lemire 2018-11-30 20:36:56 -05:00
parent a8b99984f2
commit 0e4804137c
2 changed files with 9 additions and 4 deletions

View File

@ -254,12 +254,14 @@ WARN_UNUSED
return false;
}
// we are going to zero out everything after len:
/*size_t count_last_64bits = len % 64;
size_t count_last_64bits = len % 64;
if(count_last_64bits != 0) { // we have a "final" word where only count_last_64bits matter
u64 lastword = *(u64 *)(pj.structurals + len / 8);
printf("last word %zu \n", lastword);
printf("count_last_64bits%zu \n", count_last_64bits);
lastword &= ( UINT64_C(1) << count_last_64bits) - 1;
*(u64 *)(pj.structurals + len / 8) = lastword;
}*/
}
//pj.structural_indexes[pj.n_structural_indexes++] = len; // the final NULL is used as a pseudo-structural character
#ifdef UTF8VALIDATE

View File

@ -118,7 +118,10 @@ bool flatten_indexes(size_t len, ParsedJson &pj) {
#endif
}
pj.n_structural_indexes = base;
base_ptr[pj.n_structural_indexes] =
0; // make it safe to dereference one beyond this array
if(len != base_ptr[pj.n_structural_indexes-1]) {
printf("last structural should be pointing at the end of the string\n");
return false;
}
base_ptr[pj.n_structural_indexes] = 0; // make it safe to dereference one beyond this array
return true;
}