# compiler_rt: add \_\_popcountsi2, \_\_popcountdi2 and \_\_popcountti2 · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/1ea650bb75e009bb37b5bd4e896a90e2a86f8583)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 1ea650bb75e009bb37b5bd4e896a90e2a86f8583

Requested commit: 1ea650bb75e009bb37b5bd4e896a90e2a86f8583

Commit: 1ea650bb75e009bb37b5bd4e896a90e2a86f8583

Tree: b23a47759b5c2f5c0f00a367227a56b03503c174

Author: Jan Philipp Hafer

Committer: Andrew Kelley

## Message

```
compiler_rt: add __popcountsi2, __popcountdi2 and __popcountti2

- apply simpler approach than LLVM for __popcountdi2
  taken from The Art of Computer Programming and generalized
- rename popcountdi2.zig to popcount.zig
- test cases derived from popcountdi2_test.zig
- tests: compare naive approach 10_000 times with
  random numbers created from naive seed 42

    See #1290

```

## Parents

- [d3426ce634a09ec289480510040b3decfbd38c39](https://git.cafe/gitcafe/zig/commit/d3426ce634a09ec289480510040b3decfbd38c39?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/1ea650bb75e009bb37b5bd4e896a90e2a86f8583?format=markdown)
