40 #include <pcl/pcl_config.h> 41 #include <boost/cstdint.hpp> 49 using boost::uint16_t;
51 using boost::uint32_t;
53 using boost::uint64_t;
54 using boost::int_fast16_t;
57 #if defined __INTEL_COMPILER 58 #pragma warning disable 2196 2536 279 66 #pragma warning (disable: 4018 4244 4267 4521 4251 4661 4305 4503 4146) 72 #ifndef _USE_MATH_DEFINES 73 #define _USE_MATH_DEFINES 78 #if defined _WIN32 && defined _MSC_VER 83 # define M_PI 3.14159265358979323846 // pi 84 # define M_PI_2 1.57079632679489661923 // pi/2 85 # define M_PI_4 0.78539816339744830962 // pi/4 86 # define M_PIl 3.1415926535897932384626433832795029L // pi 87 # define M_PI_2l 1.5707963267948966192313216916397514L // pi/2 88 # define M_PI_4l 0.7853981633974483096156608458198757L // pi/4 96 # define pcl_isnan(x) _isnan(x) 97 # define pcl_isfinite(x) (_finite(x) != 0) 98 # define pcl_isinf(x) (_finite(x) == 0) 100 # define __PRETTY_FUNCTION__ __FUNCTION__ 101 # define __func__ __FUNCTION__ 106 # define pcl_isnan(x) std::isnan(x) 107 # define pcl_isfinite(x) std::isfinite(x) 108 # define pcl_isinf(x) std::isinf(x) 110 #elif _GLIBCXX_USE_C99_MATH 113 # define pcl_isnan(x) std::isnan(x) 114 # define pcl_isfinite(x) std::isfinite(x) 115 # define pcl_isinf(x) std::isinf(x) 120 template <
typename T>
int 126 # define pcl_isfinite(x) std::isfinite(x) 127 # define pcl_isinf(x) std::isinf(x) 132 # define pcl_isnan(x) isnan(x) 133 # define pcl_isfinite(x) isfinite(x) 134 # define pcl_isinf(x) isinf(x) 139 #define DEG2RAD(x) ((x)*0.017453293) 143 #define RAD2DEG(x) ((x)*57.29578) 148 #define PCL_LINEAR_VERSION(major,minor,patch) ((major)<<16|(minor)<<8|(patch)) 155 pcl_round (
double number)
157 return (number < 0.0 ? ceil (number - 0.5) : floor (number + 0.5));
160 pcl_round (
float number)
162 return (number < 0.0f ? ceilf (number - 0.5f) : floorf (number + 0.5f));
166 #define pcl_lrint(x) (lrint(static_cast<double> (x))) 167 #define pcl_lrintf(x) (lrintf(static_cast<float> (x))) 169 #define pcl_lrint(x) (static_cast<long int>(pcl_round(x))) 170 #define pcl_lrintf(x) (static_cast<long int>(pcl_round(x))) 178 return (static_cast<float> (logf (x) * M_LOG2E));
183 #define pcl_sleep(x) Sleep(1000*(x)) 185 #define pcl_sleep(x) sleep(x) 190 #s << " = " << (s) << std::flush 194 #s << " = " << (s) << "\n" 198 #s << " = " << (s) << ", " << std::flush 202 #s << " = " << (s) << " " << std::flush 206 #s << " = " << RAD2DEG(s) << "deg" << std::flush 210 #s << " = " << RAD2DEG(s) << "deg\n" 214 #s << " = " << RAD2DEG(s) << "deg, " << std::flush 218 #s << " = " << RAD2DEG(s) << "deg " << std::flush 222 std::fixed << s << std::resetiosflags(std::ios_base::fixed) 225 #define ERASE_STRUCT(var) memset(&var, 0, sizeof(var)) 229 #define ERASE_ARRAY(var, size) memset(var, 0, size*sizeof(*var)) 233 #define SET_ARRAY(var, value, size) { for (int i = 0; i < static_cast<int> (size); ++i) var[i]=value; } 264 #define PCL_EXTERN_C extern "C" 270 #if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__ 271 #ifdef PCLAPI_EXPORTS 272 #define PCL_EXPORTS __declspec(dllexport) 280 #if defined WIN32 || defined _WIN32 281 #define PCL_CDECL __cdecl 282 #define PCL_STDCALL __stdcall 289 #define PCLAPI(rettype) PCL_EXTERN_C PCL_EXPORTS rettype PCL_CDECL 301 #ifndef __has_extension 302 #define __has_extension(x) 0 // Compatibility with pre-3.0 compilers. 305 #if (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) < PCL_LINEAR_VERSION(4,5,0) && ! defined(__clang__)) || defined(__INTEL_COMPILER) 306 #define PCL_DEPRECATED(message) __attribute__ ((deprecated)) 310 #if (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= PCL_LINEAR_VERSION(4,5,0)) || (defined(__clang__) && __has_extension(attribute_deprecated_with_message)) 311 #define PCL_DEPRECATED(message) __attribute__ ((deprecated(message))) 315 #define PCL_DEPRECATED(message) __declspec(deprecated(message)) 318 #ifndef PCL_DEPRECATED 319 #pragma message("WARNING: You need to implement PCL_DEPRECATED for this compiler") 320 #define PCL_DEPRECATED(message) 340 #if (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) < PCL_LINEAR_VERSION(4,5,0) && ! defined(__clang__)) || defined(__INTEL_COMPILER) 341 #define PCL_DEPRECATED_CLASS(func, message) __attribute__ ((deprecated)) func 345 #if (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= PCL_LINEAR_VERSION(4,5,0)) || (defined(__clang__) && __has_extension(attribute_deprecated_with_message)) 346 #define PCL_DEPRECATED_CLASS(func, message) __attribute__ ((deprecated(message))) func 350 #define PCL_DEPRECATED_CLASS(func, message) __declspec(deprecated(message)) func 353 #ifndef PCL_DEPRECATED_CLASS 354 #pragma message("WARNING: You need to implement PCL_DEPRECATED_CLASS for this compiler") 355 #define PCL_DEPRECATED_CLASS(func) func 358 #if defined (__GNUC__) || defined (__PGI) || defined (__IBMCPP__) || defined (__SUNPRO_CC) 359 #define PCL_ALIGN(alignment) __attribute__((aligned(alignment))) 360 #elif defined (_MSC_VER) 361 #define PCL_ALIGN(alignment) __declspec(align(alignment)) 363 #error Alignment not supported on your platform 366 #if defined(__GLIBC__) && PCL_LINEAR_VERSION(__GLIBC__,__GLIBC_MINOR__,0)>PCL_LINEAR_VERSION(2,8,0) 367 #define GLIBC_MALLOC_ALIGNED 1 369 #define GLIBC_MALLOC_ALIGNED 0 372 #if defined(__FreeBSD__) && !defined(__arm__) && !defined(__mips__) 373 #define FREEBSD_MALLOC_ALIGNED 1 375 #define FREEBSD_MALLOC_ALIGNED 0 378 #if defined(__APPLE__) || defined(_WIN64) || GLIBC_MALLOC_ALIGNED || FREEBSD_MALLOC_ALIGNED 379 #define MALLOC_ALIGNED 1 382 #if defined (HAVE_MM_MALLOC) 383 #include <mm_malloc.h> 387 aligned_malloc (
size_t size)
390 #if defined (MALLOC_ALIGNED) 391 ptr = std::malloc (size);
392 #elif defined (HAVE_POSIX_MEMALIGN) 393 if (posix_memalign (&ptr, 16, size))
395 #elif defined (HAVE_MM_MALLOC) 396 ptr = _mm_malloc (size, 16);
397 #elif defined (_MSC_VER) 398 ptr = _aligned_malloc (size, 16);
399 #elif defined (ANDROID) 400 ptr = memalign (16, size);
402 #error aligned_malloc not supported on your platform 409 aligned_free (
void* ptr)
411 #if defined (MALLOC_ALIGNED) || defined (HAVE_POSIX_MEMALIGN) 413 #elif defined (HAVE_MM_MALLOC) 415 #elif defined (_MSC_VER) 417 #elif defined (ANDROID) 420 #error aligned_free not supported on your platform 424 #endif //#ifndef PCL_MACROS_H_