refactor: weights are now wrapped in a Maybe.

This commit is contained in:
Spencer Brower
2026-07-30 09:21:58 -04:00
parent df14d76a85
commit d03e3469b3
6 changed files with 62 additions and 73 deletions
+2 -2
View File
@@ -387,8 +387,8 @@ sort_pages :: proc(pages: #soa[]Page) {
}
compare_pages :: proc(pages: #soa[]Page, j: int, key: Page) -> int {
wj := pages.weight[j]
wk := key.weight
wj := pages.weight[j].? or_else DEFAULT_WEIGHT
wk := key.weight.? or_else DEFAULT_WEIGHT
if wj != wk do return wj - wk
// Equal weight → date descending
if pages.date[j] < key.date do return 1