From 89cb740e1c7d3cfd2a5c6b22aba9ff724021f352 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 24 Apr 2025 15:24:44 -0500 Subject: [PATCH] Fixed lfsr_o_isbshrub falling out-of-date In hindsight this was way too fragile. Explicitly checking for both LFS_TYPE_REG and LFS_type_TRAVERSAL (the 2 in-device types that can have attached bshrubs) solves this and hopefully prevents lfsr_o_isbshrub from falling out-of-date in the future. The downside being a little bit more code: code stack ctx before: 35832 2440 640 after: 35864 (+0.1%) 2440 (+0.0%) 640 (+0.0%) Found by test_traversal_mutation_mroot_split_bshrub_l and test_traversal_mutation_mroot_split_bshrub_r. --- lfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lfs.c b/lfs.c index 34b548b4..63e28a6f 100644 --- a/lfs.c +++ b/lfs.c @@ -6890,8 +6890,8 @@ static inline uint32_t lfsr_o_settype(uint32_t flags, uint8_t type) { } static inline bool lfsr_o_isbshrub(uint32_t flags) { - // it turns out that bshrub types share a bit - return flags & 0x10000000; + return lfsr_o_type(flags) == LFS_TYPE_REG + || lfsr_o_type(flags) == LFS_type_TRAVERSAL; } static inline bool lfsr_o_isunflush(uint32_t flags) {