opencv-3.4.1-popcnt.patch 890 B

12345678910111213141516171819202122232425262728293031
  1. From a2d6fc7ac040c6ef94a36515f9ea24428f8f1ecc Mon Sep 17 00:00:00 2001
  2. From: Alexander Alekhin <alexander.alekhin@intel.com>
  3. Date: Tue, 24 Apr 2018 12:40:25 +0300
  4. Subject: [PATCH] cmake: fix popcnt detection
  5. via GCC/Clang __POPCNT__ define
  6. ---
  7. cmake/checks/cpu_popcnt.cpp | 4 +++-
  8. 1 file changed, 3 insertions(+), 1 deletion(-)
  9. diff --git a/cmake/checks/cpu_popcnt.cpp b/cmake/checks/cpu_popcnt.cpp
  10. index 16e5575108b..44c7deda053 100644
  11. --- a/cmake/checks/cpu_popcnt.cpp
  12. +++ b/cmake/checks/cpu_popcnt.cpp
  13. @@ -4,12 +4,14 @@
  14. # define CV_POPCNT_U64 _mm_popcnt_u64
  15. # endif
  16. # define CV_POPCNT_U32 _mm_popcnt_u32
  17. -#else
  18. +#elif defined(__POPCNT__)
  19. # include <popcntintrin.h>
  20. # if defined(__x86_64__)
  21. # define CV_POPCNT_U64 __builtin_popcountll
  22. # endif
  23. # define CV_POPCNT_U32 __builtin_popcount
  24. +#else
  25. +# error "__POPCNT__ is not defined by compiler"
  26. #endif
  27. int main()