Skip to content

Commit dc507a7

Browse files
committed
Changed required alignment of lookahead_size to 64 bits
This is to prepare for future compatibility with other implementations of the allocator's lookahead that are under consideration. The most promising design so far is a sort of segments-list data structure that stores pointer+size pairs, requiring 64-bits of alignment. Changing this now takes advantage of the major version to avoid a compatibility break in the future. If we end up not changing the allocator or don't need 64-bit alignment we can easily drop this requirement without breaking anyone's code.
1 parent 5b26c68 commit dc507a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3095,8 +3095,8 @@ static int lfs_init(lfs_t *lfs, const struct lfs_config *cfg) {
30953095
lfs_cache_zero(lfs, &lfs->rcache);
30963096
lfs_cache_zero(lfs, &lfs->pcache);
30973097

3098-
// setup lookahead, must be multiple of 32-bits
3099-
LFS_ASSERT(lfs->cfg->lookahead_size % 4 == 0);
3098+
// setup lookahead, must be multiple of 64-bits
3099+
LFS_ASSERT(lfs->cfg->lookahead_size % 8 == 0);
31003100
LFS_ASSERT(lfs->cfg->lookahead_size > 0);
31013101
if (lfs->cfg->lookahead_buffer) {
31023102
lfs->free.buffer = lfs->cfg->lookahead_buffer;

0 commit comments

Comments
 (0)