Repository navigation
refactor(imagepacker): Replace bit counting loop with std::has_single_bit - #3722
CryoTheRenegade wants to merge 1 commit into
Conversation
…_bit The target size check counted the set bits in a loop to test for a power of two. std::has_single_bit does the same test, including the rejection of zero. bit_adapter.h adds std::has_single_bit for VC6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughThe VC6 utility fallback now provides ChangesImagePacker size validation
Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Refactor Possibly related PRs
Suggested reviewers: Merge Risk:
|
Follow-up to #3652 in the C++20 adapter series. ImagePacker counts the set bits of the target size in a loop to check for a power of two, which is what C++20
std::has_single_bitdoes.ImagePacker::getSettingsFromDialogcallsstd::has_single_bit, andbit_adapter.hgets a VC6 fallback for it next tobit_ceil.A size of zero is still rejected, as the existing comment says.
Evidence
Disassembly of
ImagePacker.cpp, main against this branch, ClangCL and VC6 Release, both games. OnlygetSettingsFromDialogchanges, with the same float arithmetic and calls:lea,xor,cmp/jax != 0, thenlea,testThe VC6 count grows only by alignment
nops. ImagePacker is a tool, so no game code changes.AI Assistance:
Claude Opus 5.5 was used to assist implementation and disassembly