Skip to content

Promote internal _Countl_zero to __msvc_bit_utils.hpp to reduce code duplication and improve consistency - #5696

Merged
Stephan T. Lavavej (StephanTLavavej) merged 3 commits into
microsoft:mainfrom
AlexGuteniev:contr_zero_consistency
Sep 10, 2025
Merged

Conversation

@AlexGuteniev

@AlexGuteniev Alex Guteniev (AlexGuteniev) commented Aug 26, 2025

Copy link
Copy Markdown
Contributor

Some changes to improve consistency:

  • Rename _Countl_zero_internal to just _Countl_zero, consistently with _Countr_zero and _Popcount.
  • Promote it from __msvc_int128.hpp to __msvc_bit_utils.hpp, where _Countr_zero and _Popcount already are
  • This allows some code de-duplication, and dropping _STD in countl_one, whuch also increases consistency.
@AlexGuteniev
Alex Guteniev (AlexGuteniev) requested a review from a team as a code owner August 26, 2025 09:58
@github-project-automation github-project-automation Bot moved this to Initial Review in STL Code Reviews Aug 26, 2025
@AlexGuteniev Alex Guteniev (AlexGuteniev) changed the title Promote internal _Countl_zero to __msvc_bit_utils.hpp Aug 26, 2025
@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) added the enhancement Something can be improved label Aug 28, 2025
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks, this is great! I love the reduction of code duplication. 😻 😻

@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) moved this from Initial Review to Ready To Merge in STL Code Reviews Aug 28, 2025
@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) moved this from Ready To Merge to Merging in STL Code Reviews Sep 10, 2025
@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed

@StephanTLavavej

Copy link
Copy Markdown
Member

I've fixed a stealth merge conflict with #5637.

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit d08317c into microsoft:main Sep 10, 2025
39 checks passed
@github-project-automation github-project-automation Bot moved this from Merging to Done in STL Code Reviews Sep 10, 2025
@StephanTLavavej

Copy link
Copy Markdown
Member

Alex Guteniev (@AlexGuteniev), he's my hero, gonna take code duplication down to zero! 🦸‍♂️ 🌍 😹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

2 participants