diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-28 14:49:57 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-04-28 14:49:57 -0300 |
commit | c6c21c2c1c811508f4cb467dcd5288af20870334 (patch) | |
tree | 0c91d1d8da0baafda9ac10db583dded70077d2b8 /point.c | |
parent | 7ceba65d88079536d3b4b7132ad93fb3943c483d (diff) | |
download | jet-c6c21c2c1c811508f4cb467dcd5288af20870334.tar.gz jet-c6c21c2c1c811508f4cb467dcd5288af20870334.zip |
Improve performance on very large files
Diffstat (limited to 'point.c')
-rw-r--r-- | point.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -14,22 +14,22 @@ uint16_t index_to_offset(struct point *point) { } } +bool same_point(struct point *a, struct point *b) { + return a->page == b->page && a->index == b->index; +} + uint8_t element(struct point *point) { if (point->index == point->page->element_count) { - return point->page->next->elements[0]; + if (!point->page->next) { + return EOF; + } else { + return point->page->next->elements[0]; + } } else { return point->page->elements[index_to_offset(point)]; } } -bool same_location(struct point *a, struct point *b) { - return a->page == b->page && a->index == b->index; -} - -bool at_eof(struct point *point) { - return point->index == point->page->element_count && !point->page->next; -} - void move_point_forward(struct point *point) { if (point->index < point->page->element_count) { point->index++; |