mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #2290] buffer_va_index: use numeric_limits<Id>::max() in max_id() for signed Id types #2294
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2294
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2290
Author: @narekshaghoyandev
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:ubiq-buffer-va-index-signed-max-id📝 Commits (1)
31bd3bdbuffer_va_index: use numeric_limits::max() in max_id() for signed Id types📊 Changes
2 files changed (+14 additions, -1 deletions)
View changed files
📝
runtime/src/buffer_va_index.h(+2 -1)📝
runtime/test/buffer_va_index_test.cpp(+12 -0)📄 Description
Summary
(std::numeric_limits<Id>::max)()instead of~Id(0)inBufferVaIndex<Id>::max_id()(runtime/src/buffer_va_index.h).Idtypes (e.g.int),~Id(0)evaluates to-1, which causesranges_.upper_bound({va, max_id()})infind()to stop before all non-negative IDs atstart == vaand miss ranges starting at the queried VA.(std::numeric_limits<Id>::max)()works for both signed and unsigned integerIdtypes (parenthesised to avoid Windowsmaxmacro collisions).signed_id_cases()regression coverage toruntime/test/buffer_va_index_test.cpp.Verification
g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -Wno-mismatched-new-delete -pedantic -O2 -g runtime/test/buffer_va_index_test.cpp— pass (fixed cases, signed ID cases, 200 random tables).g++ -std=c++20 -Wall -Wextra -Werror -Wno-mismatched-new-delete -pedantic -fsanitize=undefined -O2 -g runtime/test/buffer_va_index_test.cpp— pass.main: fails (FAIL: signed Id: exact start picks larger positive id, exit 1) before the patch and passes after.python3 -I scripts/check_no_game_data.py runtime/src/buffer_va_index.h runtime/test/buffer_va_index_test.cpp— clean.Claimed in the coordination issue as: RT-BUFFER-VA-INDEX-SIGNED-MAX-ID (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192490144)
AI-assisted: yes (Gemini)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.