PCL
Defs.h
Go to the documentation of this file.
1
// ____ ______ __
2
// / __ \ / ____// /
3
// / /_/ // / / /
4
// / ____// /___ / /___ PixInsight Class Library
5
// /_/ \____//_____/ PCL 2.6.5
6
// ----------------------------------------------------------------------------
7
// pcl/Defs.h - Released 2024-01-13T15:47:58Z
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
144
// ----------------------------------------------------------------------------
145
// General definitions used by all PixInsight modules and programs.
146
// Included directly by PCL API and PixInsight source modules.
147
// ----------------------------------------------------------------------------
148
149
/*
150
* One and only one platform selection macro has to be defined.
151
*/
152
#ifndef __PCL_FREEBSD
153
# ifndef __PCL_LINUX
154
# ifndef __PCL_MACOS
155
# ifndef __PCL_MACOSX
156
# ifndef __PCL_WINDOWS
157
# error No platform selection macro has been defined.
158
# endif
159
# endif
160
# endif
161
# endif
162
#endif
163
164
/*
165
* __PCL_MACOS and __PCL_MACOSX are synonyms and both always defined on macOS.
166
*/
167
#ifdef __PCL_MACOS
168
# ifndef __PCL_MACOSX
169
# define __PCL_MACOSX
170
# endif
171
#endif
172
#ifdef __PCL_MACOSX
173
# ifndef __PCL_MACOS
174
# define __PCL_MACOS
175
# endif
176
#endif
177
178
/*
179
* Check for conflicting platform selection macros.
180
*/
181
#ifdef __PCL_FREEBSD
182
# if defined( __PCL_LINUX ) || defined( __PCL_MACOSX ) || defined( __PCL_WINDOWS )
183
# error Multiple platform selection macros have been defined.
184
# endif
185
#endif
186
#ifdef __PCL_LINUX
187
# if defined( __PCL_FREEBSD ) || defined( __PCL_MACOSX ) || defined( __PCL_WINDOWS )
188
# error Multiple platform selection macros have been defined.
189
# endif
190
#endif
191
#ifdef __PCL_MACOSX
192
# if defined( __PCL_FREEBSD ) || defined( __PCL_LINUX ) || defined( __PCL_WINDOWS )
193
# error Multiple platform selection macros have been defined.
194
# endif
195
#endif
196
#ifdef __PCL_WINDOWS
197
# if defined( __PCL_FREEBSD ) || defined( __PCL_LINUX ) || defined( __PCL_MACOSX )
198
# error Multiple platform selection macros have been defined.
199
# endif
200
#endif
201
202
/*
203
* __PCL_UNIX is always defined on FreeBSD, Linux and macOS platforms.
204
*/
205
#if defined( __PCL_LINUX ) || defined( __PCL_FREEBSD ) || defined( __PCL_MACOSX )
206
# ifndef __PCL_UNIX
207
# define __PCL_UNIX
208
# endif
209
#endif
210
211
/*
212
* __PCL_X11 is always defined on FreeBSD and Linux platforms.
213
*/
214
#if defined( __PCL_LINUX ) || defined( __PCL_FREEBSD )
215
# ifndef __PCL_X11
216
# define __PCL_X11
217
# endif
218
#endif
219
220
/*
221
* Platform architecture requirements:
222
*
223
* - x86_64 / EM64T / AMD64 architecture.
224
*/
225
#ifndef __x86_64__
226
# ifndef __x86_64
227
# ifndef __amd64__
228
# ifndef __amd64
229
# ifndef _M_X64
230
# ifndef _M_AMD64
231
# error This version of PCL requires an x86_64 / EM64T / AMD64 architecture.
232
# endif
233
# endif
234
# endif
235
# endif
236
# endif
237
#endif
238
#ifndef __PCL_X64
239
# define __PCL_X64
240
#endif
241
242
/*
243
* Compiler requirements:
244
*
245
* - GCC >= 7 on UNIX/Linux
246
* - Clang >= 5 on UNIX/Linux
247
* - MSVC++ >= 15.0 / Visual Studio 2017 on Windows
248
*/
249
#ifdef __PCL_WINDOWS
250
# ifdef _MSC_VER
251
# if _MSC_VER < 1910
252
# error This version of PCL requires MSVC++ 15.0 / Visual Studio 2017 or higher on MS Windows platforms.
253
# endif
254
# else
255
# error Unsupported C++ compiler on MS Windows platform.
256
# endif
257
#else
258
# ifdef _MSC_VER
259
# error _MSC_VER should not be #defined on UNIX/Linux platforms.
260
# else
261
# ifdef __clang__
262
# if ( __clang_major__ < 5 )
263
# error This version of PCL requires Clang 5 or higher on UNIX/Linux platforms.
264
# endif
265
# else
266
# ifdef __GNUC__
267
# if ( __GNUC__ < 7 )
268
# error This version of PCL requires GCC 7 or higher on UNIX/Linux platforms.
269
# endif
270
# else
271
# error Unsupported C++ compiler on UNIX/Linux platform.
272
# endif
273
# endif
274
# endif
275
#endif
276
277
/*
278
* Brain-damaged compilers emit particularly useless warning messages.
279
* N.B.: This must be done *before* including windows.h
280
*/
281
#ifndef __PCL_NO_WARNING_MUTE_PRAGMAS
282
# ifdef _MSC_VER
283
# define _CRT_SECURE_NO_DEPRECATE 1 // Deal with MS's attempt at deprecating C standard runtime functions
284
# pragma warning( disable: 4996 ) // ...
285
# pragma warning( disable: 4018 ) // '<' : signed/unsigned mismatch
286
# pragma warning( disable: 4049 ) // More than 64k source lines
287
# pragma warning( disable: 4150 ) // Deletion of pointer to incomplete type 'type'; no destructor called
288
# pragma warning( disable: 4244 ) // Conversion from 'type1' to 'type2', possible loss of data
289
# pragma warning( disable: 4345 ) // Behavior change: an object of POD type constructed...
290
# pragma warning( disable: 4355 ) // 'this' : used in base member initializer list
291
# pragma warning( disable: 4521 ) // Multiple copy constructors defined
292
# pragma warning( disable: 4522 ) // Multiple assignment operators defined
293
# pragma warning( disable: 4710 ) // Function not inlined
294
# pragma warning( disable: 4723 ) // Potential divide by 0
295
# pragma warning( disable: 4800 ) // 'boolean' : forcing value to bool 'true' or 'false' (performance warning)
296
# endif
297
#endif
298
299
/*
300
* Compiler warning management macros
301
*/
302
#ifdef _MSC_VER
303
# define PCL_WARNINGS_PUSH \
304
__pragma(warning(push))
305
#else
306
# define PCL_WARNINGS_PUSH \
307
_Pragma("GCC diagnostic push")
308
#endif
309
310
#ifdef _MSC_VER
311
# define PCL_WARNINGS_POP \
312
__pragma(warning(pop))
313
#else
314
# define PCL_WARNINGS_POP \
315
_Pragma("GCC diagnostic pop")
316
#endif
317
318
#ifdef _MSC_VER
319
# define PCL_WARNINGS_DISABLE_UNINITIALIZED_VARIABLE \
320
__pragma(warning( disable: 6001 )) \
321
__pragma(warning( disable: 4700 ))
322
#else
323
# define PCL_WARNINGS_DISABLE_UNINITIALIZED_VARIABLE \
324
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
325
#endif
326
327
// Disable C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
328
#ifdef _MSC_VER
329
# define PCL_WARNINGS_DISABLE_SIZE_T_TO_INT_LOSS \
330
__pragma(warning( disable: 4267 ))
331
#endif
332
333
/*
334
* Disable unused variable warnings. This solution is portable for all
335
* compilers supporting C++11 or newer. The function call should be optimized
336
* away by any reasonable compiler (including MSVC :).
337
*/
338
template
<
typename
... Args>
inline
void
__pcl_unused__( Args&&... ) {}
339
#define PCL_UNUSED( x ) __pcl_unused__( x );
340
341
/*
342
* Code optimization with unlikely/likely macros: Help the compiler to optimize
343
* for execution paths that are more likely to run.
344
*/
345
#ifndef __PCL_NO_BRANCH_OPTIMIZATION_MACROS
346
# if defined( __GNUC__ ) || defined( __clang__ )
347
# define unlikely( expr ) __builtin_expect( !!(expr), 0 )
348
# define likely( expr ) __builtin_expect( !!(expr), 1 )
349
# else
350
# define unlikely( expr ) (expr)
351
# define likely( expr ) (expr)
352
# endif
353
#endif
354
355
/*
356
* On Windows/MSVC++, _CRT_RAND_S must be #defined for rand_s() to work:
357
* http://msdn.microsoft.com/en-us/library/sxtz2fa8.aspx
358
*/
359
#ifdef _MSC_VER
360
# define _CRT_RAND_S
361
#endif
362
363
/*
364
* C standard definitions.
365
*/
366
#ifndef __stddef_h
367
# include <stddef.h>
368
# ifndef __stddef_h
369
# define __stddef_h
370
# endif
371
#endif
372
373
/*
374
* C++11: Utility functions.
375
*/
376
#ifndef __utility_h
377
# include <utility>
378
# ifndef __utility_h
379
# define __utility_h
380
# endif
381
#endif
382
383
/*
384
* C++11: Compile-time type information classes.
385
*/
386
#ifndef __type_traits_h
387
# include <type_traits>
388
# ifndef __type_traits_h
389
# define __type_traits_h
390
# endif
391
#endif
392
393
/*
394
* C++11: std::initializer_list.
395
*/
396
#ifndef __initializer_list_h
397
# include <initializer_list>
398
# ifndef __initializer_list_h
399
# define __initializer_list_h
400
# endif
401
#endif
402
403
/*
404
* Macros that control global symbol visibility.
405
*
406
* On UNIX/Linux, compilation with -fvisibility=hidden is required for PCL and
407
* all PixInsight modules and applications.
408
*/
409
#ifdef _MSC_VER // Windows
410
# define PCL_EXPORT __declspec(dllexport)
411
# define PCL_MODULE_EXPORT extern "C" PCL_EXPORT
412
# define PCL_IMPORT __declspec(dllimport)
413
# define PCL_LOCAL
414
# define PCL_BEGIN_LOCAL
415
# define PCL_END_LOCAL
416
# define PCL_INTERNAL
417
# define PCL_BEGIN_INTERNAL
418
# define PCL_END_INTERNAL
419
#else // Linux/X11, FreeBSD/X11 and Mac OS X
420
# define PCL_EXPORT __attribute__((visibility ("default")))
421
# if defined( __clang__ ) // Clang does not have the "externally_visible" attribute
422
# define PCL_MODULE_EXPORT extern "C" __attribute__((visibility ("default")))
423
# else
424
# define PCL_MODULE_EXPORT extern "C" __attribute__((visibility ("default"), externally_visible))
425
# endif
426
# define PCL_IMPORT __attribute__((visibility ("default")))
427
# define PCL_LOCAL __attribute__((visibility ("hidden")))
428
# define PCL_BEGIN_LOCAL _Pragma ( "GCC visibility push( hidden )" )
429
# define PCL_END_LOCAL _Pragma ( "GCC visibility pop" )
430
# define PCL_INTERNAL __attribute__((visibility ("internal")))
431
# define PCL_BEGIN_INTERNAL _Pragma ( "GCC visibility push( internal )" )
432
# define PCL_END_INTERNAL _Pragma ( "GCC visibility pop" )
433
#endif
434
#ifdef __PCL_DSO // Using PCL as a dynamic shared object - ### untested/experimental
435
# ifdef __PCL_BUILDING_PCL_DSO // building the PCL DSO
436
# define PCL_PUBLIC PCL_EXPORT
437
# else // linking against the PCL DSO
438
# define PCL_PUBLIC PCL_IMPORT
439
# endif
440
#else // Using PCL as a static library
441
# define PCL_PUBLIC
442
#endif
443
444
/*
445
* The PCL_CLASS, PCL_FUNC and PCL_DATA macros allow us to modify attributes in
446
* all declarations of PCL API classes, functions and data items, respectively.
447
*/
448
#define PCL_CLASS PCL_PUBLIC
449
#define PCL_FUNC PCL_PUBLIC
450
#define PCL_DATA PCL_PUBLIC
451
452
/*
453
* Stringification of macro-expanded arguments needs two levels of macros.
454
*/
455
#define PCL_STRINGIFY( x ) #x
456
457
/*
458
* Fastcall calling convention.
459
*/
460
#ifndef __PCL_NO_FASTCALL
461
# ifdef _MSC_VER
462
# define PCL_FASTCALL __fastcall
463
# else
464
# define PCL_FASTCALL __attribute__((fastcall))
465
# endif
466
#else
467
# define PCL_FASTCALL
468
#endif
469
470
/*
471
* Always inline functions.
472
*/
473
#ifndef __PCL_NO_FORCE_INLINE
474
# ifdef _MSC_VER // Visual Studio
475
# define PCL_FORCE_INLINE __forceinline
476
# else
477
# define PCL_FORCE_INLINE inline __attribute__((always_inline))
478
# endif
479
#else
480
# define PCL_FORCE_INLINE
481
#endif
482
483
/*
484
* Special GCC function optimizations.
485
*/
486
#ifndef __PCL_NO_HOT_FUNCTIONS
487
# ifdef _MSC_VER
488
# define PCL_HOT_FUNCTION
489
# else
490
# define PCL_HOT_FUNCTION __attribute__((hot))
491
# endif
492
#else
493
# define PCL_HOT_FUNCTION
494
#endif
495
496
/*
497
* Aligned memory allocation functions.
498
*/
499
#ifdef _MSC_VER
500
# define PCL_ALIGNED_MALLOC _aligned_malloc
501
# define PCL_ALIGNED_FREE _aligned_free
502
#else
503
# define PCL_ALIGNED_MALLOC _mm_malloc
504
# define PCL_ALIGNED_FREE _mm_free
505
#endif
506
507
/*
508
* 16/32-byte aligned blocks for automatic vectorization.
509
*/
510
#ifdef _MSC_VER // Windows
511
# define PCL_ALIGNED_16 __declspec(align(16))
512
# define PCL_ASSUME_ALIGNED_16( x ) x
513
# define PCL_ALIGNED_32 __declspec(align(32))
514
# define PCL_ASSUME_ALIGNED_32( x ) x
515
#else // GCC and Clang
516
# define PCL_ALIGNED_16 __attribute__((aligned(16)))
517
# define PCL_ASSUME_ALIGNED_16( x ) __builtin_assume_aligned( x, 16 )
518
# define PCL_ALIGNED_32 __attribute__((aligned(32)))
519
# define PCL_ASSUME_ALIGNED_32( x ) __builtin_assume_aligned( x, 32 )
520
#endif
521
522
/*
523
* Let the restrict type qualifier be the same for all supported C++ compilers.
524
*/
525
#ifdef _MSC_VER
526
// ### N.B. Unfortunately, __restrict is not allowed in /permissive- mode
527
// # define __restrict__ __restrict
528
# define __restrict__
/* no-op */
529
#endif
530
531
/*
532
* Compiler pragmas to assume iteration independence for vectorization.
533
*/
534
#ifdef _MSC_VER
535
# define PCL_IVDEP __pragma(loop( ivdep ))
536
#else
537
# ifdef __clang__
538
# define PCL_IVDEP
539
# else
540
# ifdef __GNUC__
541
# define PCL_IVDEP _Pragma("GCC ivdep")
542
# endif
543
# endif
544
#endif
545
546
/*
547
* Loop unrolling pragmas.
548
*/
549
#define PCL_PRAGMA( x ) _Pragma( #x )
550
#ifdef _MSC_VER
551
# define PCL_UNROLL( n )
552
#else
553
# ifdef __clang__
554
# define PCL_UNROLL( n ) PCL_PRAGMA( clang loop unroll_count( n ) )
555
# else
556
# ifdef __GNUC__
557
# define PCL_UNROLL( n ) PCL_PRAGMA( GCC unroll n )
558
# endif
559
# endif
560
#endif
561
562
/*
563
* Current function name.
564
*/
565
#ifdef _MSC_VER
566
# define PCL_FUNCTION_NAME __FUNCTION__
567
#else
568
# define PCL_FUNCTION_NAME __func__
569
#endif
570
571
/*
572
* MSVC defines 'max' and 'min' macros that conflict with several standard
573
* library functions, such as std::numeric_limits<>::max().
574
*/
575
#ifdef _MSC_VER
576
# ifndef NOMINMAX
577
# define NOMINMAX 1 // needs to be defined before #include windows.h
578
# endif
579
# ifdef max
580
# undef max
581
# endif
582
# ifdef min
583
# undef min
584
# endif
585
#endif
586
587
/*
588
* Minimum Win32 versions supported.
589
*/
590
#ifdef __PCL_WINDOWS
591
# ifndef __PCL_NO_WIN32_MINIMUM_VERSIONS
592
# define WINVER 0x0601 // Windows 7
593
# define _WIN32_WINNT 0x0601
594
# endif
595
#endif
596
597
/*
598
* Size and distance types.
599
*/
600
#ifndef __PCL_NO_SIZE_AND_DISTANCE_TYPES
601
602
namespace
pcl
603
{
612
using
size_type
= size_t;
613
618
using
distance_type
= ptrdiff_t;
619
620
}
// pcl
621
622
#endif // !__PCL_NO_SIZE_AND_DISTANCE_TYPES
623
624
/*
625
* Portable integer types
626
*/
627
#ifndef __PCL_NO_PORTABLE_INTEGER_TYPES
628
629
namespace
pcl
630
{
639
using
int8
=
signed
char;
640
645
using
uint8
=
unsigned
char;
646
651
using
int16
=
signed
short;
652
657
using
uint16
=
unsigned
short;
658
663
using
int32
=
signed
int;
664
669
using
uint32
=
unsigned
int;
670
671
#ifdef _MSC_VER // Valid for MS Visual C++
672
using
int64
=
signed
__int64;
673
using
uint64
=
unsigned
__int64;
674
#else // Valid for gcc
675
679
using
int64
=
signed
long
long;
680
685
using
uint64
=
unsigned
long
long;
686
#endif // _MSC_VER
687
688
struct
PCL_AssertScalarSizes
689
{
690
static_assert(
sizeof
(
int8
) == 1,
"Invalid sizeof( int8 )"
);
691
static_assert(
sizeof
(
uint8
) == 1,
"Invalid sizeof( uint8 )"
);
692
static_assert(
sizeof
(
int16
) == 2,
"Invalid sizeof( int16 )"
);
693
static_assert(
sizeof
(
uint16
) == 2,
"Invalid sizeof( uint16 )"
);
694
static_assert(
sizeof
(
int32
) == 4,
"Invalid sizeof( int32 )"
);
695
static_assert(
sizeof
(
uint32
) == 4,
"Invalid sizeof( uint32 )"
);
696
static_assert(
sizeof
(
int64
) == 8,
"Invalid sizeof( int64 )"
);
697
static_assert(
sizeof
(
uint64
) == 8,
"Invalid sizeof( uint64 )"
);
698
static_assert(
sizeof
(
float
) ==
sizeof
(
uint32
),
"Invalid sizeof( float )"
);
699
static_assert(
sizeof
(
double
) ==
sizeof
(
uint64
),
"Invalid sizeof( double )"
);
700
};
701
702
}
// pcl
703
704
/*
705
* Integer limits
706
*/
707
#ifndef __PCL_NO_INTEGER_LIMITS
708
717
#ifdef _MSC_VER // Valid for MS Visual C++
718
719
#define int8_min (-127i8-1)
720
#define int8_max 127i8
721
#define int8_ofs 128ui8
722
#define char_min int8_min
723
#define char_max int8_max
724
725
#define uint8_max 0xffui8
726
727
#define int16_min (-32767i16-1)
728
#define int16_max 32767i16
729
#define int16_ofs 32768ui16
730
#define short_min int16_min
731
#define short_max int16_max
732
733
#define uint16_max 0xffffui16
734
#define ushort_max uint16_max
735
736
#define uint20_max 0xfffffui32
737
738
#define uint22_max 0x3fffffui32
739
740
#define uint24_max 0xffffffui32
741
742
#define int32_min (-2147483647i32-1)
743
#define int32_max 2147483647i32
744
#define int32_ofs 2147483648ui32
745
#define int_min int32_min
746
#define int_max int32_max
747
748
#define uint32_max 0xffffffffui32
749
#define uint_max uint32_max
750
751
#define int64_min (-9223372036854775807i64-1)
752
#define int64_max 9223372036854775807i64
753
#define int64_ofs 9223372036854775808ui64
754
#define longlong_min int64_min
755
#define longlong_max int64_max
756
757
#define uint64_max 0xffffffffffffffffui64
758
#define ulonglong_max uint64_max
759
760
#define uint8_to_uint16 257ui16
761
#define uint8_to_uint20 4.1120588235294117647058823529412e+03
762
#define uint8_to_uint24 65793ui32
763
#define uint8_to_uint32 16843009ui32
764
#define uint8_to_uint64 72340172838076673ui64
765
766
#define uint16_to_uint8 3.8910505836575875486381322957198e-03
767
#define uint16_to_uint20 1.6000228885328450446326390478370e+01
768
#define uint16_to_uint24 2.5600389105058365758754863813230e+02
769
#define uint16_to_uint32 65537ui32
770
#define uint16_to_uint64 281479271743489ui64
771
772
#define uint20_to_uint8 2.4318718260496387955081896860024e-04
773
#define uint20_to_uint16 6.2499105929475717044560474930262e-02
774
#define uint20_to_uint24 1.6000014305128388527287032401116e+01
775
#define uint20_to_uint32 4.0960039053000500679493598455046e+03
776
#define uint20_to_uint64 1.7592202821648000014305128388527e+13
777
778
#define uint24_to_uint8 1.5199185323666651467481343000015e-05
779
#define uint24_to_uint16 3.9061906281823294271427051510039e-03
780
#define uint24_to_uint20 6.2499944120642192402016663671533e-02
781
#define uint24_to_uint32 2.5600001519918532366665146748134e+02
782
#define uint24_to_uint64 1.0995116933120039061906281823294e+12
783
784
#define uint32_to_uint8 5.9371814145560333073502484027646e-08
785
#define uint32_to_uint16 1.5258556235409005599890138395105e-05
786
#define uint32_to_uint20 2.4414039222619971079430536152662e-04
787
#define uint32_to_uint24 3.9062497680788509939049489316309e-03
788
#define uint32_to_uint64 4294967297ui64
789
790
#define uint64_to_uint8 1.3823577699190181534344400859741e-17
791
#define uint64_to_uint16 3.5526594686918766543265110209534e-15
792
#define uint64_to_uint20 5.6843364650699390597549726005894e-14
793
#define uint64_to_uint24 9.0949464756281961368912116576494e-13
794
#define uint64_to_uint32 2.3283064359965952029459655278022e-10
795
796
#else // Non-MS C++, i.e. GCC or compatible
797
802
#define int8_min (-int8( 127 )-1)
803
808
#define int8_max int8( 127 )
809
#define int8_ofs uint8( 128u )
810
#define char_min int8_min
811
#define char_max int8_max
812
817
#define uint8_max uint8( 0xffu )
818
823
#define int16_min (-int16( 32767 )-1)
824
829
#define int16_max int16( 32767 )
830
#define int16_ofs uint16( 32768u )
831
#define short_min int16_min
832
#define short_max int16_max
833
838
#define uint16_max uint16( 0xffffu )
839
#define ushort_max uint16_max
840
845
#define uint20_max uint32( 0xfffffu )
846
851
#define uint22_max uint32( 0x3fffffu )
852
857
#define uint24_max uint32( 0xffffffu )
858
863
#define int32_min (-int32( 2147483647 )-1)
864
869
#define int32_max int32( 2147483647 )
870
#define int32_ofs uint32( 2147483648u )
871
#define int_min int32_min
872
#define int_max int32_max
873
878
#define uint32_max uint32( 0xffffffffu )
879
#define uint_max uint32_max
880
885
#define int64_min (-int64( 9223372036854775807ll )-1)
886
891
#define int64_max int64( 9223372036854775807ll )
892
#define int64_ofs uint64( 9223372036854775808ull )
893
#define longlong_min int64_min
894
#define longlong_max int64_max
895
900
#define uint64_max uint64( 0xffffffffffffffffull )
901
#define ulonglong_max uint64_max
902
907
#define uint8_to_uint16 uint16( 257u )
908
913
#define uint8_to_uint20 4.1120588235294117647058823529412e+03
914
919
#define uint8_to_uint24 uint32( 65793u )
920
925
#define uint8_to_uint32 uint32( 16843009u )
926
931
#define uint8_to_uint64 uint64( 72340172838076673ull )
932
937
#define uint16_to_uint8 3.8910505836575875486381322957198e-03
938
943
#define uint16_to_uint20 1.6000228885328450446326390478370e+01
944
949
#define uint16_to_uint24 2.5600389105058365758754863813230e+02
950
955
#define uint16_to_uint32 uint32( 65537u )
956
961
#define uint16_to_uint64 uint64( 281479271743489ull )
962
967
#define uint20_to_uint8 2.4318718260496387955081896860024e-04
968
973
#define uint20_to_uint16 6.2499105929475717044560474930262e-02
974
979
#define uint20_to_uint24 1.6000014305128388527287032401116e+01
980
985
#define uint20_to_uint32 4.0960039053000500679493598455046e+03
986
991
#define uint20_to_uint64 1.7592202821648000014305128388527e+13
992
997
#define uint24_to_uint8 1.5199185323666651467481343000015e-05
998
1003
#define uint24_to_uint16 3.9061906281823294271427051510039e-03
1004
1009
#define uint24_to_uint20 6.2499944120642192402016663671533e-02
1010
1015
#define uint24_to_uint32 2.5600001519918532366665146748134e+02
1016
1021
#define uint24_to_uint64 1.0995116933120039061906281823294e+12
1022
1027
#define uint32_to_uint8 5.9371814145560333073502484027646e-08
1028
1033
#define uint32_to_uint16 1.5258556235409005599890138395105e-05
1034
1039
#define uint32_to_uint20 2.4414039222619971079430536152662e-04
1040
1045
#define uint32_to_uint24 3.9062497680788509939049489316309e-03
1046
1051
#define uint32_to_uint64 uint64( 4294967297ull )
1052
1057
#define uint64_to_uint8 1.3823577699190181534344400859741e-17
1058
1063
#define uint64_to_uint16 3.5526594686918766543265110209534e-15
1064
1069
#define uint64_to_uint20 5.6843364650699390597549726005894e-14
1070
1075
#define uint64_to_uint24 9.0949464756281961368912116576494e-13
1076
1081
#define uint64_to_uint32 2.3283064359965952029459655278022e-10
1082
1083
#endif // _MSC_VER
1084
1085
namespace
pcl
1086
{
1087
1088
inline
double
BitMin(
int
n )
1089
{
1090
switch
( n )
1091
{
1092
case
8:
return
double(
int8_min
);
1093
case
16:
return
double(
int16_min
);
1094
case
32:
return
double(
int32_min
);
1095
case
64:
return
double(
int64_min
);
1096
default
:
return
-double( (
uint64
( 1 ) << n) >> 1 );
1097
}
1098
}
1099
1100
inline
double
BitMax(
int
n )
1101
{
1102
switch
( n )
1103
{
1104
case
8:
return
double(
int8_max
);
1105
case
16:
return
double(
int16_max
);
1106
case
32:
return
double(
int32_max
);
1107
case
64:
return
double(
int64_max
);
1108
default
:
return
double( ((
uint64
( 1 ) << n) >> 1) - 1 );
1109
}
1110
}
1111
1112
inline
double
UBitMax(
int
n )
1113
{
1114
switch
( n )
1115
{
1116
case
8:
return
double(
uint8_max
);
1117
case
16:
return
double(
uint16_max
);
1118
case
32:
return
double(
uint32_max
);
1119
case
64:
return
double(
uint64_max
);
1120
default
:
return
double( (
uint64
( 1 ) << n) - 1 );
1121
}
1122
}
1123
1124
}
// pcl
1125
1126
#endif // !__PCL_NO_INTEGER_LIMITS
1127
1128
/*
1129
* Unicode character types.
1130
*/
1131
#ifndef __PCL_NO_UNICODE_CHARACTER_TYPES
1132
1133
namespace
pcl
1134
{
1135
1144
using
char16_type
=
uint16
;
1145
1150
using
char32_type
=
uint32
;
1151
1152
}
// pcl
1153
1154
#endif // !__PCL_NO_UNICODE_CHARACTER_TYPES
1155
1156
/*
1157
* File size and position types.
1158
*/
1159
#ifndef __PCL_NO_FILE_SIZE_AND_POSITION_TYPES
1160
1161
#ifndef __PCL_WINDOWS
1162
# ifndef _FILE_OFFSET_BITS
1163
# define _FILE_OFFSET_BITS 64
1164
# endif
1165
# define _LARGEFILE_SOURCE 1
1166
# define _LARGEFILE64_SOURCE 1
1167
#endif
1168
1169
namespace
pcl
1170
{
1171
1182
using
fpos_type
=
int64
;
1183
1188
using
fsize_type
=
int64
;
1189
1190
}
// pcl
1191
1192
#endif // !__PCL_NO_FILE_SIZE_AND_POSITION_TYPES
1193
1194
#endif // !__PCL_NO_PORTABLE_INTEGER_TYPES
1195
1196
/*
1197
* Maximum number of processors allowed.
1198
*/
1199
#define PCL_MAX_PROCESSORS 1023
1200
#define PCL_MAX_PROCESSORS_BITCOUNT 10
1201
1202
// ----------------------------------------------------------------------------
1203
1204
#endif // __PCL_Defs_h
1205
1206
// ----------------------------------------------------------------------------
1207
// EOF pcl/Defs.h - Released 2024-01-13T15:47:58Z
pcl
PCL root namespace.
Definition:
AbstractImage.h:76
pcl::int16
signed short int16
Definition:
Defs.h:651
int16_min
#define int16_min
Definition:
Defs.h:823
pcl::char32_type
uint32 char32_type
Definition:
Defs.h:1150
uint32_max
#define uint32_max
Definition:
Defs.h:878
uint16_max
#define uint16_max
Definition:
Defs.h:838
pcl::uint32
unsigned int uint32
Definition:
Defs.h:669
pcl::int8
signed char int8
Definition:
Defs.h:639
pcl::uint16
unsigned short uint16
Definition:
Defs.h:657
uint64_max
#define uint64_max
Definition:
Defs.h:900
int16_max
#define int16_max
Definition:
Defs.h:829
pcl::size_type
size_t size_type
Definition:
Defs.h:612
pcl::uint64
unsigned long long uint64
Definition:
Defs.h:685
int32_min
#define int32_min
Definition:
Defs.h:863
pcl::uint8
unsigned char uint8
Definition:
Defs.h:645
pcl::distance_type
ptrdiff_t distance_type
Definition:
Defs.h:618
int8_max
#define int8_max
Definition:
Defs.h:808
pcl::fsize_type
int64 fsize_type
Definition:
Defs.h:1188
pcl::int32
signed int int32
Definition:
Defs.h:663
int64_max
#define int64_max
Definition:
Defs.h:891
pcl::fpos_type
int64 fpos_type
Definition:
Defs.h:1182
pcl::int64
signed long long int64
Definition:
Defs.h:679
int32_max
#define int32_max
Definition:
Defs.h:869
pcl::char16_type
uint16 char16_type
Definition:
Defs.h:1144
uint8_max
#define uint8_max
Definition:
Defs.h:817
int8_min
#define int8_min
Definition:
Defs.h:802
int64_min
#define int64_min
Definition:
Defs.h:885
Defs.h
Generated on Sun Jan 14 2024 20:52:43 for PCL by
1.8.17