rbyd: Added LFS_ASSERTRBYDBALANCE for asserting rbyds are balanced

This is _not_ free, so an opt-in define is needed.

This is also expected to fail right now due to balance issues with
diverging yellow nodes in range-removals, but it's the first step
towards trying to fix said balance issues.

I've been trying to avoid adding debug machinery to lfs.c itself, since
it tends to hurt readability, but I really don't know how you could
assert rbyd balance out-of-tree short of trying to fetch every block in
emubd somehow...

Oh well, finding and asserting rbyd balance in lfsr_rbyd_fetch at least
doesn't require that much code.

No code changes, thanks to const-propagation.
This commit is contained in:
Christopher Haster
2025-01-22 15:01:18 -06:00
parent 68f0534dd0
commit 94f493ec2e
2 changed files with 63 additions and 2 deletions
+6
View File
@@ -168,6 +168,12 @@ extern "C"
#define LFS_IFDEF_GC(a, b) (b)
#endif
#ifdef LFS_ASSERTRBYDBALANCE
#define LFS_IFDEF_ASSERTRBYDBALANCE(a, b) (a)
#else
#define LFS_IFDEF_ASSERTRBYDBALANCE(a, b) (b)
#endif
// Builtin functions, these may be replaced by more efficient
// toolchain-specific implementations. LFS_NO_BUILTINS falls back to a more