Limited did generation to 31-bits

Otherwise this risks overflowing 31-bit leb128 limits elsewhere in the
system.

I think at some point I was considering allowing _some_ types to be
full 32-bit leb128s, mainly lfs_block_t and lfs_did_t, but at this point
it doesn't seem worth the tradeoffs (especially if you can jump to
64-bits/63-bits in the future). It also never worked to be clear.
This commit is contained in:
Christopher Haster
2024-02-26 02:34:18 -06:00
parent 09ebf70bd9
commit 7d232078f2
+1 -1
View File
@@ -8681,7 +8681,7 @@ int lfsr_mkdir(lfs_t *lfs, const char *path) {
lfsr_did_t dmask = (1 << lfs_min32(
lfs_nlog2(lfsr_mtree_weight(&lfs->mtree))
+ lfs_nlog2(lfs->cfg->block_size/32),
32)) - 1;
31)) - 1;
lfsr_did_t did_ = lfs_crc32c(0, path, strlen(path)) & dmask;
// Check if we have a collision. If we do, search for the next