Skip to content

Commit

Permalink
Merge pull request #1 from redstar/popcnt
Browse files Browse the repository at this point in the history
Add implementation of popcnt.
  • Loading branch information
redstar committed Feb 18, 2012
2 parents 3645d7e + e62bab4 commit 5cde6e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/bitop.d
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@ else
*/
version (LDC)
{
int popcnt(uint x);
private pure pragma(intrinsic, "llvm.ctpop.i#") T ctpop(T)(T v);
pure int popcnt(uint x)
{
return cast(int) ctpop(x);
}
}
else
{
Expand Down

0 comments on commit 5cde6e3

Please sign in to comment.