Skip to content

Comments

Make popcount cross-platform#3402

Closed
eelstork wants to merge 1 commit intoBVLC:masterfrom
BonsaiAI:popcount-compatibility
Closed

Make popcount cross-platform#3402
eelstork wants to merge 1 commit intoBVLC:masterfrom
BonsaiAI:popcount-compatibility

Conversation

@eelstork
Copy link
Contributor

@eelstork eelstork commented Dec 2, 2015

__builtin__popcount is a built-in GCC function. There is no standard C/C++ equivalent.

For portability I provide an explicit popcount implementation; for performance on Windows, MSVC built-ins are suggested.

Compiler specific code may be avoided; should we make an exception in this case?

Implementation note

_GNUC_ is also defined with llvm/clang; testing for __llvm__ and/or __clang__ will not behave as expected. Less naive compiler macros might be used (at the cost of adding Boost headers).

Currently pop count is only used in hamming_distance; It would appear that Caffe does not use this function.

@ronghanghu
Copy link
Member

I guess you don't need this one. You can perhaps just remove caffe_cpu_hamming_distance IMO.

Actually I don't think you need caffe_cpu_hamming_distance at all, and it is perhaps a mistake to merge it one year ago...

@longjon
Copy link
Contributor

longjon commented Dec 2, 2015

Obsoleted by #3404.

@longjon longjon closed this Dec 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants