openbsd-ports/misc/openbabel/patches/patch-src_fingerprint_cpp
brad e2b3c7c7cf Pull in a patch from the openbabel source repo to remove
the unconditional use of __builtin_popcount if using GCC.
Eliminates the need for a newer GCC version.

ok ajacoutot@
2008-09-01 08:51:03 +00:00

17 lines
786 B
Plaintext

$OpenBSD: patch-src_fingerprint_cpp,v 1.1 2008/09/01 08:51:03 brad Exp $
--- src/fingerprint.cpp.orig Sun Aug 31 22:57:28 2008
+++ src/fingerprint.cpp Sun Aug 31 22:58:30 2008
@@ -100,7 +100,11 @@ namespace OpenBabel
int andfp = vec1[i] & vec2[i];
int orfp = vec1[i] | vec2[i];
//Count bits
-#ifdef __GNUC__
+ /* GCC 3.4 supports a "population count" builtin, which on many targets is
+ implemented with a single instruction. There is a fallback definition
+ in libgcc in case a target does not have one, which should be just as
+ good as the static function below. */
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
andbits += __builtin_popcount(andfp);
orbits += __builtin_popcount(orfp);
#else