lemire / FastPFor

The FastPFOR C++ library: Fast integer compression
Apache License 2.0
873 stars 123 forks source link

Multiple definition error on __builtin_clz() in MSVC #44

Closed kimikage closed 5 years ago

kimikage commented 5 years ago

In MSVC, the header file util.h defines a function __builtin_clz(). Since it is not a inline function, a multiple definition error LNK2005 can occur. https://github.com/lemire/FastPFor/blob/d873fe18edf487ff7e4e737883e6f63a54a0a578/headers/util.h#L117-L126

A possible solution is adding the inline to the function:

inline uint32_t __builtin_clz(uint32_t x) {
lemire commented 5 years ago

Would you issue a PR? This way you get credit for your contribution.