Skip to content

Commit

Permalink
Add a prefetch function for varstr.
Browse files Browse the repository at this point in the history
  • Loading branch information
wangtzh committed Apr 19, 2020
1 parent d4b7c4e commit dd8343a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions varstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ struct varstr {
inline operator lcdf::Str() const { return lcdf::Str(p, l); }
#endif

inline void prefetch() {
uint32_t i = 0;
do {
::prefetch((const char *)(p + i));
i += CACHE_LINE_SIZE;
} while (i < l);
}

uint64_t l;
fat_ptr ptr;
const uint8_t *p; // must be the last field
Expand Down

0 comments on commit dd8343a

Please sign in to comment.