extunix icon indicating copy to clipboard operation
extunix copied to clipboard

Adding `__builtin_popcount()`

Open H-ANSEN opened this issue 5 months ago • 4 comments

While GCC's __builtin_popcount() is not an official or drafted POSIX call and not a system specific call it seems fitting that it could be added to the ExtUnix library. I was not able to find an Ocaml FFI implementation outside of Jane Street libraries.

I would love to make a pull request adding this, the respective GCC or Clang builtin could be called using compiler defines with a naive implementation if neither is found. If this would not fit in the ExtUnix library and anyone knows of alternative libraries that either already have this function or would accept its addition please let me know.

Thanks!

H-ANSEN avatar Jul 19 '25 17:07 H-ANSEN