Skip to content

feat: replace custom format with std::format#66

Open
FurryAcetylCoA wants to merge 8 commits intoOpenXiangShan:masterfrom
FurryAcetylCoA:fmt
Open

feat: replace custom format with std::format#66
FurryAcetylCoA wants to merge 8 commits intoOpenXiangShan:masterfrom
FurryAcetylCoA:fmt

Conversation

@FurryAcetylCoA
Copy link
Contributor

This PR replaces the custom formatting implementation with std::format As dzwduan recommended in #57
However fmt::printf require additional build-time requirement, so I choose std::format instead

This has zero impact on gsim performance.

However std::format require C++20 headers and libraries which current(2025.4.19) debian stable(bookworm) can't compile out-of-box (require install clang++-19 and libc++-19-dev manually)

If maintaining compatibility with plain Debian stable is a priority for the project, this PR might not be advisable to merge, as it would complicate the build environment requirements

Before moving to std::format, it would be better to check the
current usage of format
In 65c41e0, jaypiper use a bitop optimize trick to make conditional
update into logical operation (hint: cond is Bool and -(uint8_t)1 is
0xFF)
However, jaypiper forgot to remove the last argument of the format
thus leading to a stray format
haven't figureout why uintptr_t is chosen. but i think ull is big
enough. It might be too big, leaving that to the TODO
The GNU C++ lib is too old on bookworm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant