[PATCH] D132407: [ADT] Add llvm::ctpop to <bit> helper wrapper

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 12:24:02 PDT 2022


RKSimon created this revision.
RKSimon added reviewers: dblaikie, MaskRay, kazu.
Herald added a subscriber: StephenFan.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added a project: LLVM.

This patch proposes to move the llvm::detail::PopulationCounter internal helpers into ADT/bit.h and provide a llvm::ctpop implementation.

I've left the countPopulation implementation in place in MathExtras.h for now, but updated it to use llvm::ctpop.

Hopefully I've got the type_traits correct - I don't use them very often.

Someday we'll move to C++20 with an actual <bit> std header, and we already have this header in place to simplify matters. We'd probably benefit from moving the other <bit> helpers here at some point, but this is a first step.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132407

Files:
  llvm/include/llvm/ADT/bit.h
  llvm/include/llvm/Support/MathExtras.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132407.454593.patch
Type: text/x-patch
Size: 3518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220822/106262c2/attachment.bin>


More information about the llvm-commits mailing list