PCL
Defs.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.7.0
6 // ----------------------------------------------------------------------------
7 // pcl/Defs.h - Released 2024-06-18T15:48:54Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2024 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (https://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_Defs_h
53 #define __PCL_Defs_h
54 
56 
141 // ----------------------------------------------------------------------------
142 // General definitions used by all PixInsight modules and programs.
143 // Included directly by PCL API and PixInsight source modules.
144 // ----------------------------------------------------------------------------
145 
146 /*
147  * One and only one platform selection macro has to be defined.
148  */
149 #ifndef __PCL_FREEBSD
150 # ifndef __PCL_LINUX
151 # ifndef __PCL_MACOS
152 # ifndef __PCL_MACOSX
153 # ifndef __PCL_WINDOWS
154 # error No platform selection macro has been defined.
155 # endif
156 # endif
157 # endif
158 # endif
159 #endif
160 
161 /*
162  * __PCL_MACOS and __PCL_MACOSX are synonyms and both always defined on macOS.
163  */
164 #ifdef __PCL_MACOS
165 # ifndef __PCL_MACOSX
166 # define __PCL_MACOSX
167 # endif
168 #endif
169 #ifdef __PCL_MACOSX
170 # ifndef __PCL_MACOS
171 # define __PCL_MACOS
172 # endif
173 #endif
174 
175 /*
176  * Check for conflicting platform selection macros.
177  */
178 #ifdef __PCL_FREEBSD
179 # if defined( __PCL_LINUX ) || defined( __PCL_MACOSX ) || defined( __PCL_WINDOWS )
180 # error Multiple platform selection macros have been defined.
181 # endif
182 #endif
183 #ifdef __PCL_LINUX
184 # if defined( __PCL_FREEBSD ) || defined( __PCL_MACOSX ) || defined( __PCL_WINDOWS )
185 # error Multiple platform selection macros have been defined.
186 # endif
187 #endif
188 #ifdef __PCL_MACOSX
189 # if defined( __PCL_FREEBSD ) || defined( __PCL_LINUX ) || defined( __PCL_WINDOWS )
190 # error Multiple platform selection macros have been defined.
191 # endif
192 #endif
193 #ifdef __PCL_WINDOWS
194 # if defined( __PCL_FREEBSD ) || defined( __PCL_LINUX ) || defined( __PCL_MACOSX )
195 # error Multiple platform selection macros have been defined.
196 # endif
197 #endif
198 
199 /*
200  * __PCL_UNIX is always defined on FreeBSD, Linux and macOS platforms.
201  */
202 #if defined( __PCL_LINUX ) || defined( __PCL_FREEBSD ) || defined( __PCL_MACOSX )
203 # ifndef __PCL_UNIX
204 # define __PCL_UNIX
205 # endif
206 #endif
207 
208 /*
209  * __PCL_X11 is always defined on FreeBSD and Linux platforms.
210  */
211 #if defined( __PCL_LINUX ) || defined( __PCL_FREEBSD )
212 # ifndef __PCL_X11
213 # define __PCL_X11
214 # endif
215 #endif
216 
217 /*
218  * Platform architecture requirements:
219  *
220  * - x86_64 / EM64T / AMD64 architecture.
221  */
222 #ifndef __x86_64__
223 # ifndef __x86_64
224 # ifndef __amd64__
225 # ifndef __amd64
226 # ifndef _M_X64
227 # ifndef _M_AMD64
228 # error This version of PCL requires an x86_64 / EM64T / AMD64 architecture.
229 # endif
230 # endif
231 # endif
232 # endif
233 # endif
234 #endif
235 #ifndef __PCL_X64
236 # define __PCL_X64
237 #endif
238 
239 /*
240  * Compiler requirements:
241  *
242  * - GCC >= 7 on UNIX/Linux
243  * - Clang >= 5 on UNIX/Linux
244  * - MSVC++ >= 15.0 / Visual Studio 2017 on Windows
245  */
246 #ifdef __PCL_WINDOWS
247 # ifdef _MSC_VER
248 # if _MSC_VER < 1910
249 # error This version of PCL requires MSVC++ 15.0 / Visual Studio 2017 or higher on MS Windows platforms.
250 # endif
251 # else
252 # error Unsupported C++ compiler on MS Windows platform.
253 # endif
254 #else
255 # ifdef _MSC_VER
256 # error _MSC_VER should not be #defined on UNIX/Linux platforms.
257 # else
258 # ifdef __clang__
259 # if ( __clang_major__ < 5 )
260 # error This version of PCL requires Clang 5 or higher on UNIX/Linux platforms.
261 # endif
262 # else
263 # ifdef __GNUC__
264 # if ( __GNUC__ < 7 )
265 # error This version of PCL requires GCC 7 or higher on UNIX/Linux platforms.
266 # endif
267 # else
268 # error Unsupported C++ compiler on UNIX/Linux platform.
269 # endif
270 # endif
271 # endif
272 #endif
273 
274 /*
275  * Brain-damaged compilers emit particularly useless warning messages.
276  * N.B.: This must be done *before* including windows.h
277  */
278 #ifndef __PCL_NO_WARNING_MUTE_PRAGMAS
279 # ifdef _MSC_VER
280 # define _CRT_SECURE_NO_DEPRECATE 1 // Deal with MS's attempt at deprecating C standard runtime functions
281 # pragma warning( disable: 4996 ) // ...
282 # pragma warning( disable: 4018 ) // '<' : signed/unsigned mismatch
283 # pragma warning( disable: 4049 ) // More than 64k source lines
284 # pragma warning( disable: 4150 ) // Deletion of pointer to incomplete type 'type'; no destructor called
285 # pragma warning( disable: 4244 ) // Conversion from 'type1' to 'type2', possible loss of data
286 # pragma warning( disable: 4345 ) // Behavior change: an object of POD type constructed...
287 # pragma warning( disable: 4355 ) // 'this' : used in base member initializer list
288 # pragma warning( disable: 4521 ) // Multiple copy constructors defined
289 # pragma warning( disable: 4522 ) // Multiple assignment operators defined
290 # pragma warning( disable: 4710 ) // Function not inlined
291 # pragma warning( disable: 4723 ) // Potential divide by 0
292 # pragma warning( disable: 4800 ) // 'boolean' : forcing value to bool 'true' or 'false' (performance warning)
293 # endif
294 #endif
295 
296 /*
297  * Compiler warning management macros
298  */
299 #ifdef _MSC_VER
300 # define PCL_WARNINGS_PUSH \
301  __pragma(warning(push))
302 #else
303 # define PCL_WARNINGS_PUSH \
304  _Pragma("GCC diagnostic push")
305 #endif
306 
307 #ifdef _MSC_VER
308 # define PCL_WARNINGS_POP \
309  __pragma(warning(pop))
310 #else
311 # define PCL_WARNINGS_POP \
312  _Pragma("GCC diagnostic pop")
313 #endif
314 
315 #ifdef _MSC_VER
316 # define PCL_WARNINGS_DISABLE_UNINITIALIZED_VARIABLE \
317  __pragma(warning( disable: 6001 )) \
318  __pragma(warning( disable: 4700 ))
319 #else
320 # define PCL_WARNINGS_DISABLE_UNINITIALIZED_VARIABLE \
321  _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
322 #endif
323 
324 // Disable C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
325 #ifdef _MSC_VER
326 # define PCL_WARNINGS_DISABLE_SIZE_T_TO_INT_LOSS \
327  __pragma(warning( disable: 4267 ))
328 #endif
329 
330 /*
331  * Disable unused variable warnings. This solution is portable for all
332  * compilers supporting C++11 or newer. The function call should be optimized
333  * away by any reasonable compiler (including MSVC :).
334  */
335 template <typename... Args> inline void __pcl_unused__( Args&&... ) {}
336 #define PCL_UNUSED( x ) __pcl_unused__( x );
337 
338 /*
339  * Code optimization with unlikely/likely macros: Help the compiler to optimize
340  * for execution paths that are more likely to run.
341  */
342 #ifndef __PCL_NO_BRANCH_OPTIMIZATION_MACROS
343 # if defined( __GNUC__ ) || defined( __clang__ )
344 # define unlikely( expr ) __builtin_expect( !!(expr), 0 )
345 # define likely( expr ) __builtin_expect( !!(expr), 1 )
346 # else
347 # define unlikely( expr ) (expr)
348 # define likely( expr ) (expr)
349 # endif
350 #endif
351 
352 /*
353  * On Windows/MSVC++, _CRT_RAND_S must be #defined for rand_s() to work:
354  * http://msdn.microsoft.com/en-us/library/sxtz2fa8.aspx
355  */
356 #ifdef _MSC_VER
357 # define _CRT_RAND_S
358 #endif
359 
360 /*
361  * C standard definitions.
362  */
363 #ifndef __stddef_h
364 # include <stddef.h>
365 # ifndef __stddef_h
366 # define __stddef_h
367 # endif
368 #endif
369 
370 /*
371  * C++11: Utility functions.
372  */
373 #ifndef __utility_h
374 # include <utility>
375 # ifndef __utility_h
376 # define __utility_h
377 # endif
378 #endif
379 
380 /*
381  * C++11: Compile-time type information classes.
382  */
383 #ifndef __type_traits_h
384 # include <type_traits>
385 # ifndef __type_traits_h
386 # define __type_traits_h
387 # endif
388 #endif
389 
390 /*
391  * C++11: std::initializer_list.
392  */
393 #ifndef __initializer_list_h
394 # include <initializer_list>
395 # ifndef __initializer_list_h
396 # define __initializer_list_h
397 # endif
398 #endif
399 
400 /*
401  * Macros that control global symbol visibility.
402  *
403  * On UNIX/Linux, compilation with -fvisibility=hidden is required for PCL and
404  * all PixInsight modules and applications.
405  */
406 #ifdef _MSC_VER // Windows
407 # define PCL_EXPORT __declspec(dllexport)
408 # define PCL_MODULE_EXPORT extern "C" PCL_EXPORT
409 # define PCL_IMPORT __declspec(dllimport)
410 # define PCL_LOCAL
411 # define PCL_BEGIN_LOCAL
412 # define PCL_END_LOCAL
413 # define PCL_INTERNAL
414 # define PCL_BEGIN_INTERNAL
415 # define PCL_END_INTERNAL
416 #else // Linux/X11, FreeBSD/X11 and Mac OS X
417 # define PCL_EXPORT __attribute__((visibility ("default")))
418 # if defined( __clang__ ) // Clang does not have the "externally_visible" attribute
419 # define PCL_MODULE_EXPORT extern "C" __attribute__((visibility ("default")))
420 # else
421 # define PCL_MODULE_EXPORT extern "C" __attribute__((visibility ("default"), externally_visible))
422 # endif
423 # define PCL_IMPORT __attribute__((visibility ("default")))
424 # define PCL_LOCAL __attribute__((visibility ("hidden")))
425 # define PCL_BEGIN_LOCAL _Pragma ( "GCC visibility push( hidden )" )
426 # define PCL_END_LOCAL _Pragma ( "GCC visibility pop" )
427 # define PCL_INTERNAL __attribute__((visibility ("internal")))
428 # define PCL_BEGIN_INTERNAL _Pragma ( "GCC visibility push( internal )" )
429 # define PCL_END_INTERNAL _Pragma ( "GCC visibility pop" )
430 #endif
431 #ifdef __PCL_DSO // Using PCL as a dynamic shared object - ### untested/experimental
432 # ifdef __PCL_BUILDING_PCL_DSO // building the PCL DSO
433 # define PCL_PUBLIC PCL_EXPORT
434 # else // linking against the PCL DSO
435 # define PCL_PUBLIC PCL_IMPORT
436 # endif
437 #else // Using PCL as a static library
438 # define PCL_PUBLIC
439 #endif
440 
441 /*
442  * The PCL_CLASS, PCL_FUNC and PCL_DATA macros allow us to modify attributes in
443  * all declarations of PCL API classes, functions and data items, respectively.
444  */
445 #define PCL_CLASS PCL_PUBLIC
446 #define PCL_FUNC PCL_PUBLIC
447 #define PCL_DATA PCL_PUBLIC
448 
449 /*
450  * Stringification of macro-expanded arguments needs two levels of macros.
451  */
452 #define PCL_STRINGIFY( x ) #x
453 
454 /*
455  * Fastcall calling convention.
456  */
457 #ifndef __PCL_NO_FASTCALL
458 # ifdef _MSC_VER
459 # define PCL_FASTCALL __fastcall
460 # else
461 # define PCL_FASTCALL __attribute__((fastcall))
462 # endif
463 #else
464 # define PCL_FASTCALL
465 #endif
466 
467 /*
468  * Always inline functions.
469  */
470 #ifndef __PCL_NO_FORCE_INLINE
471 # ifdef _MSC_VER // Visual Studio
472 # define PCL_FORCE_INLINE __forceinline
473 # else
474 # define PCL_FORCE_INLINE inline __attribute__((always_inline))
475 # endif
476 #else
477 # define PCL_FORCE_INLINE
478 #endif
479 
480 /*
481  * Special GCC function optimizations.
482  */
483 #ifndef __PCL_NO_HOT_FUNCTIONS
484 # ifdef _MSC_VER
485 # define PCL_HOT_FUNCTION
486 # else
487 # define PCL_HOT_FUNCTION __attribute__((hot))
488 # endif
489 #else
490 # define PCL_HOT_FUNCTION
491 #endif
492 
493 /*
494  * Aligned memory allocation functions.
495  */
496 #ifdef _MSC_VER
497 # define PCL_ALIGNED_MALLOC _aligned_malloc
498 # define PCL_ALIGNED_FREE _aligned_free
499 #else
500 # define PCL_ALIGNED_MALLOC _mm_malloc
501 # define PCL_ALIGNED_FREE _mm_free
502 #endif
503 
504 /*
505  * 16/32-byte aligned blocks for automatic vectorization.
506  */
507 #ifdef _MSC_VER // Windows
508 # define PCL_ALIGNED_16 __declspec(align(16))
509 # define PCL_ASSUME_ALIGNED_16( x ) x
510 # define PCL_ALIGNED_32 __declspec(align(32))
511 # define PCL_ASSUME_ALIGNED_32( x ) x
512 #else // GCC and Clang
513 # define PCL_ALIGNED_16 __attribute__((aligned(16)))
514 # define PCL_ASSUME_ALIGNED_16( x ) __builtin_assume_aligned( x, 16 )
515 # define PCL_ALIGNED_32 __attribute__((aligned(32)))
516 # define PCL_ASSUME_ALIGNED_32( x ) __builtin_assume_aligned( x, 32 )
517 #endif
518 
519 /*
520  * Let the restrict type qualifier be the same for all supported C++ compilers.
521  */
522 #ifdef _MSC_VER
523 // ### N.B. Unfortunately, __restrict is not allowed in /permissive- mode
524 // # define __restrict__ __restrict
525 # define __restrict__ /* no-op */
526 #endif
527 
528 /*
529  * Compiler pragmas to assume iteration independence for vectorization.
530  */
531 #ifdef _MSC_VER
532 # define PCL_IVDEP __pragma(loop( ivdep ))
533 #else
534 # ifdef __clang__
535 # define PCL_IVDEP
536 # else
537 # ifdef __GNUC__
538 # define PCL_IVDEP _Pragma("GCC ivdep")
539 # endif
540 # endif
541 #endif
542 
543 /*
544  * Loop unrolling pragmas.
545  */
546 #define PCL_PRAGMA( x ) _Pragma( #x )
547 #ifdef _MSC_VER
548 # define PCL_UNROLL( n )
549 #else
550 # ifdef __clang__
551 # define PCL_UNROLL( n ) PCL_PRAGMA( clang loop unroll_count( n ) )
552 # else
553 # ifdef __GNUC__
554 # define PCL_UNROLL( n ) PCL_PRAGMA( GCC unroll n )
555 # endif
556 # endif
557 #endif
558 
559 /*
560  * Current function name.
561  */
562 #ifdef _MSC_VER
563 # define PCL_FUNCTION_NAME __FUNCTION__
564 #else
565 # define PCL_FUNCTION_NAME __func__
566 #endif
567 
568 /*
569  * MSVC defines 'max' and 'min' macros that conflict with several standard
570  * library functions, such as std::numeric_limits<>::max().
571  */
572 #ifdef _MSC_VER
573 # ifndef NOMINMAX
574 # define NOMINMAX 1 // needs to be defined before #include windows.h
575 # endif
576 # ifdef max
577 # undef max
578 # endif
579 # ifdef min
580 # undef min
581 # endif
582 #endif
583 
584 /*
585  * Minimum Win32 versions supported.
586  */
587 #ifdef __PCL_WINDOWS
588 # ifndef __PCL_NO_WIN32_MINIMUM_VERSIONS
589 # define WINVER 0x0601 // Windows 7
590 # define _WIN32_WINNT 0x0601
591 # endif
592 #endif
593 
594 /*
595  * Size and distance types.
596  */
597 #ifndef __PCL_NO_SIZE_AND_DISTANCE_TYPES
598 
599 namespace pcl
600 {
609 using size_type = size_t;
610 
615 using distance_type = ptrdiff_t;
616 
617 } // pcl
618 
619 #endif // !__PCL_NO_SIZE_AND_DISTANCE_TYPES
620 
621 /*
622  * Portable integer types
623  */
624 #ifndef __PCL_NO_PORTABLE_INTEGER_TYPES
625 
626 namespace pcl
627 {
636 using int8 = signed char;
637 
642 using uint8 = unsigned char;
643 
648 using int16 = signed short;
649 
654 using uint16 = unsigned short;
655 
660 using int32 = signed int;
661 
666 using uint32 = unsigned int;
667 
668 #ifdef _MSC_VER // Valid for MS Visual C++
669 using int64 = signed __int64;
670 using uint64 = unsigned __int64;
671 #else // Valid for gcc
676 using int64 = signed long long;
677 
682 using uint64 = unsigned long long;
683 #endif // _MSC_VER
684 
685 struct PCL_AssertScalarSizes
686 {
687  static_assert( sizeof( int8 ) == 1, "Invalid sizeof( int8 )" );
688  static_assert( sizeof( uint8 ) == 1, "Invalid sizeof( uint8 )" );
689  static_assert( sizeof( int16 ) == 2, "Invalid sizeof( int16 )" );
690  static_assert( sizeof( uint16 ) == 2, "Invalid sizeof( uint16 )" );
691  static_assert( sizeof( int32 ) == 4, "Invalid sizeof( int32 )" );
692  static_assert( sizeof( uint32 ) == 4, "Invalid sizeof( uint32 )" );
693  static_assert( sizeof( int64 ) == 8, "Invalid sizeof( int64 )" );
694  static_assert( sizeof( uint64 ) == 8, "Invalid sizeof( uint64 )" );
695  static_assert( sizeof( float ) == sizeof( uint32 ), "Invalid sizeof( float )" );
696  static_assert( sizeof( double ) == sizeof( uint64 ), "Invalid sizeof( double )" );
697 };
698 
699 } // pcl
700 
701 /*
702  * Integer limits
703  */
704 #ifndef __PCL_NO_INTEGER_LIMITS
705 
714 #ifdef _MSC_VER // Valid for MS Visual C++
715 
716 #define int8_min (-127i8-1)
717 #define int8_max 127i8
718 #define int8_ofs 128ui8
719 #define char_min int8_min
720 #define char_max int8_max
721 
722 #define uint8_max 0xffui8
723 
724 #define int16_min (-32767i16-1)
725 #define int16_max 32767i16
726 #define int16_ofs 32768ui16
727 #define short_min int16_min
728 #define short_max int16_max
729 
730 #define uint16_max 0xffffui16
731 #define ushort_max uint16_max
732 
733 #define uint20_max 0xfffffui32
734 
735 #define uint22_max 0x3fffffui32
736 
737 #define uint24_max 0xffffffui32
738 
739 #define int32_min (-2147483647i32-1)
740 #define int32_max 2147483647i32
741 #define int32_ofs 2147483648ui32
742 #define int_min int32_min
743 #define int_max int32_max
744 
745 #define uint32_max 0xffffffffui32
746 #define uint_max uint32_max
747 
748 #define int64_min (-9223372036854775807i64-1)
749 #define int64_max 9223372036854775807i64
750 #define int64_ofs 9223372036854775808ui64
751 #define longlong_min int64_min
752 #define longlong_max int64_max
753 
754 #define uint64_max 0xffffffffffffffffui64
755 #define ulonglong_max uint64_max
756 
757 #define uint8_to_uint16 257ui16
758 #define uint8_to_uint20 4.1120588235294117647058823529412e+03
759 #define uint8_to_uint24 65793ui32
760 #define uint8_to_uint32 16843009ui32
761 #define uint8_to_uint64 72340172838076673ui64
762 
763 #define uint16_to_uint8 3.8910505836575875486381322957198e-03
764 #define uint16_to_uint20 1.6000228885328450446326390478370e+01
765 #define uint16_to_uint24 2.5600389105058365758754863813230e+02
766 #define uint16_to_uint32 65537ui32
767 #define uint16_to_uint64 281479271743489ui64
768 
769 #define uint20_to_uint8 2.4318718260496387955081896860024e-04
770 #define uint20_to_uint16 6.2499105929475717044560474930262e-02
771 #define uint20_to_uint24 1.6000014305128388527287032401116e+01
772 #define uint20_to_uint32 4.0960039053000500679493598455046e+03
773 #define uint20_to_uint64 1.7592202821648000014305128388527e+13
774 
775 #define uint24_to_uint8 1.5199185323666651467481343000015e-05
776 #define uint24_to_uint16 3.9061906281823294271427051510039e-03
777 #define uint24_to_uint20 6.2499944120642192402016663671533e-02
778 #define uint24_to_uint32 2.5600001519918532366665146748134e+02
779 #define uint24_to_uint64 1.0995116933120039061906281823294e+12
780 
781 #define uint32_to_uint8 5.9371814145560333073502484027646e-08
782 #define uint32_to_uint16 1.5258556235409005599890138395105e-05
783 #define uint32_to_uint20 2.4414039222619971079430536152662e-04
784 #define uint32_to_uint24 3.9062497680788509939049489316309e-03
785 #define uint32_to_uint64 4294967297ui64
786 
787 #define uint64_to_uint8 1.3823577699190181534344400859741e-17
788 #define uint64_to_uint16 3.5526594686918766543265110209534e-15
789 #define uint64_to_uint20 5.6843364650699390597549726005894e-14
790 #define uint64_to_uint24 9.0949464756281961368912116576494e-13
791 #define uint64_to_uint32 2.3283064359965952029459655278022e-10
792 
793 #else // Non-MS C++, i.e. GCC or compatible
794 
799 #define int8_min (-int8( 127 )-1)
800 
805 #define int8_max int8( 127 )
806 #define int8_ofs uint8( 128u )
807 #define char_min int8_min
808 #define char_max int8_max
809 
814 #define uint8_max uint8( 0xffu )
815 
820 #define int16_min (-int16( 32767 )-1)
821 
826 #define int16_max int16( 32767 )
827 #define int16_ofs uint16( 32768u )
828 #define short_min int16_min
829 #define short_max int16_max
830 
835 #define uint16_max uint16( 0xffffu )
836 #define ushort_max uint16_max
837 
842 #define uint20_max uint32( 0xfffffu )
843 
848 #define uint22_max uint32( 0x3fffffu )
849 
854 #define uint24_max uint32( 0xffffffu )
855 
860 #define int32_min (-int32( 2147483647 )-1)
861 
866 #define int32_max int32( 2147483647 )
867 #define int32_ofs uint32( 2147483648u )
868 #define int_min int32_min
869 #define int_max int32_max
870 
875 #define uint32_max uint32( 0xffffffffu )
876 #define uint_max uint32_max
877 
882 #define int64_min (-int64( 9223372036854775807ll )-1)
883 
888 #define int64_max int64( 9223372036854775807ll )
889 #define int64_ofs uint64( 9223372036854775808ull )
890 #define longlong_min int64_min
891 #define longlong_max int64_max
892 
897 #define uint64_max uint64( 0xffffffffffffffffull )
898 #define ulonglong_max uint64_max
899 
904 #define uint8_to_uint16 uint16( 257u )
905 
910 #define uint8_to_uint20 4.1120588235294117647058823529412e+03
911 
916 #define uint8_to_uint24 uint32( 65793u )
917 
922 #define uint8_to_uint32 uint32( 16843009u )
923 
928 #define uint8_to_uint64 uint64( 72340172838076673ull )
929 
934 #define uint16_to_uint8 3.8910505836575875486381322957198e-03
935 
940 #define uint16_to_uint20 1.6000228885328450446326390478370e+01
941 
946 #define uint16_to_uint24 2.5600389105058365758754863813230e+02
947 
952 #define uint16_to_uint32 uint32( 65537u )
953 
958 #define uint16_to_uint64 uint64( 281479271743489ull )
959 
964 #define uint20_to_uint8 2.4318718260496387955081896860024e-04
965 
970 #define uint20_to_uint16 6.2499105929475717044560474930262e-02
971 
976 #define uint20_to_uint24 1.6000014305128388527287032401116e+01
977 
982 #define uint20_to_uint32 4.0960039053000500679493598455046e+03
983 
988 #define uint20_to_uint64 1.7592202821648000014305128388527e+13
989 
994 #define uint24_to_uint8 1.5199185323666651467481343000015e-05
995 
1000 #define uint24_to_uint16 3.9061906281823294271427051510039e-03
1001 
1006 #define uint24_to_uint20 6.2499944120642192402016663671533e-02
1007 
1012 #define uint24_to_uint32 2.5600001519918532366665146748134e+02
1013 
1018 #define uint24_to_uint64 1.0995116933120039061906281823294e+12
1019 
1024 #define uint32_to_uint8 5.9371814145560333073502484027646e-08
1025 
1030 #define uint32_to_uint16 1.5258556235409005599890138395105e-05
1031 
1036 #define uint32_to_uint20 2.4414039222619971079430536152662e-04
1037 
1042 #define uint32_to_uint24 3.9062497680788509939049489316309e-03
1043 
1048 #define uint32_to_uint64 uint64( 4294967297ull )
1049 
1054 #define uint64_to_uint8 1.3823577699190181534344400859741e-17
1055 
1060 #define uint64_to_uint16 3.5526594686918766543265110209534e-15
1061 
1066 #define uint64_to_uint20 5.6843364650699390597549726005894e-14
1067 
1072 #define uint64_to_uint24 9.0949464756281961368912116576494e-13
1073 
1078 #define uint64_to_uint32 2.3283064359965952029459655278022e-10
1079 
1080 #endif // _MSC_VER
1081 
1082 namespace pcl
1083 {
1084 
1085 inline double BitMin( int n )
1086 {
1087  switch ( n )
1088  {
1089  case 8: return double( int8_min );
1090  case 16: return double( int16_min );
1091  case 32: return double( int32_min );
1092  case 64: return double( int64_min );
1093  default: return -double( (uint64( 1 ) << n) >> 1 );
1094  }
1095 }
1096 
1097 inline double BitMax( int n )
1098 {
1099  switch ( n )
1100  {
1101  case 8: return double( int8_max );
1102  case 16: return double( int16_max );
1103  case 32: return double( int32_max );
1104  case 64: return double( int64_max );
1105  default: return double( ((uint64( 1 ) << n) >> 1) - 1 );
1106  }
1107 }
1108 
1109 inline double UBitMax( int n )
1110 {
1111  switch ( n )
1112  {
1113  case 8: return double( uint8_max );
1114  case 16: return double( uint16_max );
1115  case 32: return double( uint32_max );
1116  case 64: return double( uint64_max );
1117  default: return double( (uint64( 1 ) << n) - 1 );
1118  }
1119 }
1120 
1121 } // pcl
1122 
1123 #endif // !__PCL_NO_INTEGER_LIMITS
1124 
1125 /*
1126  * Unicode character types.
1127  */
1128 #ifndef __PCL_NO_UNICODE_CHARACTER_TYPES
1129 
1130 namespace pcl
1131 {
1132 
1142 
1148 
1149 } // pcl
1150 
1151 #endif // !__PCL_NO_UNICODE_CHARACTER_TYPES
1152 
1153 /*
1154  * File size and position types.
1155  */
1156 #ifndef __PCL_NO_FILE_SIZE_AND_POSITION_TYPES
1157 
1158 #ifndef __PCL_WINDOWS
1159 # ifndef _FILE_OFFSET_BITS
1160 # define _FILE_OFFSET_BITS 64
1161 # endif
1162 # define _LARGEFILE_SOURCE 1
1163 # define _LARGEFILE64_SOURCE 1
1164 #endif
1165 
1166 namespace pcl
1167 {
1168 
1180 
1186 
1187 } // pcl
1188 
1189 #endif // !__PCL_NO_FILE_SIZE_AND_POSITION_TYPES
1190 
1191 #endif // !__PCL_NO_PORTABLE_INTEGER_TYPES
1192 
1193 /*
1194  * Maximum number of processors allowed.
1195  */
1196 #define PCL_MAX_PROCESSORS 1023
1197 #define PCL_MAX_PROCESSORS_BITCOUNT 10
1198 
1199 // ----------------------------------------------------------------------------
1200 
1201 #endif // __PCL_Defs_h
1202 
1203 // ----------------------------------------------------------------------------
1204 // EOF pcl/Defs.h - Released 2024-06-18T15:48:54Z
int64 fpos_type
Definition: Defs.h:1179
int64 fsize_type
Definition: Defs.h:1185
#define int64_max
Definition: Defs.h:888
#define int8_min
Definition: Defs.h:799
#define int16_max
Definition: Defs.h:826
#define int16_min
Definition: Defs.h:820
#define int64_min
Definition: Defs.h:882
#define uint16_max
Definition: Defs.h:835
#define uint64_max
Definition: Defs.h:897
#define int32_max
Definition: Defs.h:866
#define int32_min
Definition: Defs.h:860
#define uint32_max
Definition: Defs.h:875
#define uint8_max
Definition: Defs.h:814
#define int8_max
Definition: Defs.h:805
signed char int8
Definition: Defs.h:636
unsigned long long uint64
Definition: Defs.h:682
unsigned short uint16
Definition: Defs.h:654
unsigned char uint8
Definition: Defs.h:642
signed short int16
Definition: Defs.h:648
signed long long int64
Definition: Defs.h:676
signed int int32
Definition: Defs.h:660
unsigned int uint32
Definition: Defs.h:666
ptrdiff_t distance_type
Definition: Defs.h:615
size_t size_type
Definition: Defs.h:609
uint16 char16_type
Definition: Defs.h:1141
uint32 char32_type
Definition: Defs.h:1147
PCL root namespace.
Definition: AbstractImage.h:77