46 #if defined __INTEL_COMPILER
47 #pragma warning disable 2196 2536 279
55 #pragma warning (disable: 4018 4244 4267 4521 4251 4661 4305 4503 4146)
58 #ifndef _USE_MATH_DEFINES
59 #define _USE_MATH_DEFINES
68 #if (defined _OPENMP && (_OPENMP <= 201307)) || (defined __GNUC__ && (__GNUC__ >= 6 && __GNUC__ < 9))
69 #define OPENMP_LEGACY_CONST_DATA_SHARING_RULE 1
71 #define OPENMP_LEGACY_CONST_DATA_SHARING_RULE 0
74 #include <pcl/pcl_config.h>
76 #include <boost/preprocessor/arithmetic/add.hpp>
77 #include <boost/preprocessor/comparison/equal.hpp>
78 #include <boost/preprocessor/comparison/less.hpp>
79 #include <boost/preprocessor/control/if.hpp>
80 #include <boost/preprocessor/stringize.hpp>
88 #if !defined(__CUDACC__)
89 #define _PCL_DEPRECATED_IMPL(Message) [[deprecated(Message)]]
91 #define _PCL_DEPRECATED_IMPL(Message)
93 #elif __has_cpp_attribute(deprecated)
94 #define _PCL_DEPRECATED_IMPL(Message) [[deprecated(Message)]]
96 #warning "You need to implement _PCL_DEPRECATED_IMPL for this compiler"
97 #define _PCL_DEPRECATED_IMPL(Message)
101 #if (defined (__GNUC__) || defined(__clang__))
102 #define PCL_PRAGMA(x) _Pragma (#x)
104 #define PCL_PRAGMA(x) __pragma (#x)
110 #if (defined (__GNUC__) || defined(__clang__))
111 #define _PCL_DEPRECATED_HEADER_IMPL(Message) PCL_PRAGMA (message Message)
113 #define _PCL_DEPRECATED_HEADER_IMPL(Message) PCL_PRAGMA (warning (Message))
115 #warning "You need to implement _PCL_DEPRECATED_HEADER_IMPL for this compiler"
116 #define _PCL_DEPRECATED_HEADER_IMPL(Message)
123 #define _PCL_PREPARE_REMOVAL_MESSAGE(Major, Minor, Msg) \
124 Msg " (It will be removed in PCL " BOOST_PP_STRINGIZE(Major.Minor) ")"
132 #define _PCL_COMPAT_MINOR_VERSION(Minor, IfPass, IfFail) \
133 BOOST_PP_IF(BOOST_PP_EQUAL(PCL_REVISION_VERSION, 99), \
134 BOOST_PP_IF(BOOST_PP_LESS(BOOST_PP_ADD(PCL_MINOR_VERSION, 1), Minor), IfPass, IfFail), \
135 BOOST_PP_IF(BOOST_PP_LESS(PCL_MINOR_VERSION, Minor), IfPass, IfFail))
142 #define _PCL_COMPAT_MAJOR_VERSION(Major, IfPass, IfFail) \
143 BOOST_PP_IF(BOOST_PP_EQUAL(PCL_MINOR_VERSION, 99), \
144 BOOST_PP_IF(BOOST_PP_EQUAL(BOOST_PP_ADD(PCL_MAJOR_VERSION, 1), Major), IfPass, IfFail), \
145 BOOST_PP_IF(BOOST_PP_EQUAL(PCL_MAJOR_VERSION, Major), IfPass, IfFail))
158 #define PCL_DEPRECATED(Major, Minor, Message) \
159 _PCL_COMPAT_MAJOR_VERSION( \
161 _PCL_COMPAT_MINOR_VERSION( \
163 _PCL_DEPRECATED_IMPL(_PCL_PREPARE_REMOVAL_MESSAGE(Major, Minor, Message)), \
164 unneeded_deprecation), \
165 major_version_mismatch)
178 #define PCL_DEPRECATED_HEADER(Major, Minor, Message) \
179 _PCL_COMPAT_MAJOR_VERSION( \
181 _PCL_COMPAT_MINOR_VERSION( \
183 _PCL_DEPRECATED_HEADER_IMPL(_PCL_PREPARE_REMOVAL_MESSAGE( \
186 "This header is deprecated. " Message)), \
188 major_version_mismatch)
195 #if !defined _MATH_DEFINES_DEFINED && !defined M_2_SQRTPI
196 #define _MATH_DEFINES_DEFINED
198 #define M_E 2.71828182845904523536
199 #define M_LOG2E 1.44269504088896340736
200 #define M_LOG10E 0.434294481903251827651
201 #define M_LN2 0.693147180559945309417
202 #define M_LN10 2.30258509299404568402
203 #define M_PI 3.14159265358979323846
204 #define M_PI_2 1.57079632679489661923
205 #define M_PI_4 0.785398163397448309616
206 #define M_1_PI 0.318309886183790671538
207 #define M_2_PI 0.636619772367581343076
208 #define M_2_SQRTPI 1.12837916709551257390
209 #define M_SQRT2 1.41421356237309504880
210 #define M_SQRT1_2 0.707106781186547524401
219 #define __PRETTY_FUNCTION__ __FUNCTION__
220 #define __func__ __FUNCTION__
225 #define DEG2RAD(x) ((x)*0.017453293)
229 #define RAD2DEG(x) ((x)*57.29578)
234 #define PCL_LINEAR_VERSION(major,minor,patch) ((major)<<16|(minor)<<8|(patch))
243 return (number < 0.0 ? std::ceil (number - 0.5) : std::floor (number + 0.5));
248 return (number < 0.0f ? std::ceil (number - 0.5f) : std::floor (number + 0.5f));
252 #define pcl_lrint(x) (lrint(static_cast<double> (x)))
253 #define pcl_lrintf(x) (lrintf(static_cast<float> (x)))
255 #define pcl_lrint(x) (static_cast<long int>(pcl_round(x)))
256 #define pcl_lrintf(x) (static_cast<long int>(pcl_round(x)))
260 #define pcl_sleep(x) Sleep(1000*(x))
262 #define pcl_sleep(x) sleep(x)
267 #s << " = " << (s) << std::flush
271 #s << " = " << (s) << "\n"
275 #s << " = " << (s) << ", " << std::flush
279 #s << " = " << (s) << " " << std::flush
283 #s << " = " << RAD2DEG(s) << "deg" << std::flush
287 #s << " = " << RAD2DEG(s) << "deg\n"
291 #s << " = " << RAD2DEG(s) << "deg, " << std::flush
295 #s << " = " << RAD2DEG(s) << "deg " << std::flush
299 std::fixed << (s) << std::resetiosflags(std::ios_base::fixed)
302 #define ERASE_STRUCT(var) memset(&(var), 0, sizeof(var))
306 #define ERASE_ARRAY(var, size) memset(var, 0, (size)*sizeof(*(var)))
310 #define SET_ARRAY(var, value, size) { for (decltype(size) i = 0; i < (size); ++i) (var)[i]=value; }
315 #define PCL_EXTERN_C extern "C"
321 #if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__
322 #ifdef PCLAPI_EXPORTS
323 #define PCL_EXPORTS __declspec(dllexport)
328 #ifdef PCL_SYMBOL_VISIBILITY_HIDDEN
329 #define PCL_EXPORTS __attribute__ ((visibility ("default")))
335 #if defined WIN32 || defined _WIN32
336 #define PCL_CDECL __cdecl
337 #define PCL_STDCALL __stdcall
344 #define PCLAPI(rettype) PCL_EXTERN_C PCL_EXPORTS rettype PCL_CDECL
348 #ifndef __has_extension
349 #define __has_extension(x) 0
352 #if defined (__GNUC__) || defined (__PGI) || defined (__IBMCPP__) || defined (__SUNPRO_CC)
353 #define PCL_ALIGN(alignment) __attribute__((aligned(alignment)))
354 #elif defined (_MSC_VER)
355 #define PCL_ALIGN(alignment) __declspec(align(alignment))
357 #error Alignment not supported on your platform
360 #if defined(__GLIBC__) && PCL_LINEAR_VERSION(__GLIBC__,__GLIBC_MINOR__,0)>PCL_LINEAR_VERSION(2,8,0)
361 #define GLIBC_MALLOC_ALIGNED 1
363 #define GLIBC_MALLOC_ALIGNED 0
366 #if defined(__FreeBSD__) && !defined(__arm__) && !defined(__mips__)
367 #define FREEBSD_MALLOC_ALIGNED 1
369 #define FREEBSD_MALLOC_ALIGNED 0
372 #if defined(__APPLE__) || defined(_WIN64) || GLIBC_MALLOC_ALIGNED || FREEBSD_MALLOC_ALIGNED
373 #define MALLOC_ALIGNED 1
376 #if defined (HAVE_MM_MALLOC)
378 #if defined(__INTEL_COMPILER)
381 #include <mm_malloc.h>
391 #if defined(MALLOC_ALIGNED)
392 ptr = std::malloc(size);
393 #elif defined(HAVE_POSIX_MEMALIGN)
394 if (posix_memalign(&ptr, 16, size))
396 #elif defined(HAVE_MM_MALLOC)
397 ptr = _mm_malloc(size, 16);
398 #elif defined(_MSC_VER)
399 ptr = _aligned_malloc(size, 16);
400 #elif defined(ANDROID)
401 ptr = memalign(16, size);
403 #error aligned_malloc not supported on your platform
412 #if defined(MALLOC_ALIGNED) || defined(HAVE_POSIX_MEMALIGN)
414 #elif defined(HAVE_MM_MALLOC)
416 #elif defined(_MSC_VER)
418 #elif defined(ANDROID)
421 #error aligned_free not supported on your platform
432 #if (__cplusplus >= 201703L) || (defined(_MSC_VER) && (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703L))
433 #define PCL_FALLTHROUGH [[fallthrough]];
434 #elif defined(__clang__)
435 #define PCL_FALLTHROUGH [[clang::fallthrough]];
436 #elif defined(__GNUC__) && (__GNUC__ >= 7)
437 #define PCL_FALLTHROUGH [[gnu::fallthrough]];
439 #define PCL_FALLTHROUGH
442 #if (__cplusplus >= 201703L) || (defined(_MSC_VER) && (_MSC_VER >= 1911) && (_MSVC_LANG >= 201703L))
443 #define PCL_NODISCARD [[nodiscard]]
444 #elif defined(__clang__) && (PCL_LINEAR_VERSION(__clang_major__, __clang_minor__, 0) >= PCL_LINEAR_VERSION(3, 9, 0))
445 #define PCL_NODISCARD [[clang::warn_unused_result]]
446 #elif defined(__GNUC__)
447 #define PCL_NODISCARD [[gnu::warn_unused_result]]
449 #define PCL_NODISCARD
452 #ifdef __cpp_if_constexpr
453 #define PCL_IF_CONSTEXPR(x) if constexpr(x)
455 #define PCL_IF_CONSTEXPR(x) if (x)
476 #if __has_cpp_attribute(unlikely)
477 #define PCL_CONDITION_UNLIKELY(x) (static_cast<bool>(x)) [[unlikely]]
478 #elif defined(__GNUC__)
479 #define PCL_CONDITION_UNLIKELY(x) (__builtin_expect(static_cast<bool>(x), 0))
480 #elif defined(__clang__) && (PCL_LINEAR_VERSION(__clang_major__, __clang_minor__, 0) >= PCL_LINEAR_VERSION(3, 9, 0))
481 #define PCL_CONDITION_UNLIKELY(x) (__builtin_expect(static_cast<bool>(x), 0))
483 #define PCL_CONDITION_UNLIKELY(x) (x)
486 #define PCL_IF_UNLIKELY(x) if PCL_CONDITION_UNLIKELY(x)
487 #define PCL_WHILE_UNLIKELY(x) while PCL_CONDITION_UNLIKELY(x)
void aligned_free(void *ptr)
void * aligned_malloc(std::size_t size)
__inline double pcl_round(double number)
Win32 doesn't seem to have rounding functions.