AJA NTV2 SDK  18.0.0.2717
NTV2 SDK 18.0.0.2717
ajatypes.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef AJATYPES_H
9 #define AJATYPES_H
10 
11 #if defined (AJAMac)
12  #define NTV2_USE_STDINT
13 #endif // if not MSWindows
14 
42 
43 #define NTV2_DEPRECATE // Do not undefine -- all symbols/APIs first deprecated in SDK 12.4 or earlier have been removed
44 #define NTV2_DEPRECATE_12_5 // Do not undefine -- all symbols/APIs first deprecated in SDK 12.5 have been removed
45 #define NTV2_DEPRECATE_12_6 // Do not undefine -- all symbols/APIs first deprecated in SDK 12.6 have been removed
46 #define NTV2_DEPRECATE_12_7 // Do not undefine -- all symbols/APIs first deprecated in SDK 12.7 have been removed
47 #define NTV2_DEPRECATE_13_0 // Do not undefine -- all symbols/APIs first deprecated in SDK 13.0 have been removed
48 #define NTV2_DEPRECATE_13_1 // Do not undefine -- all symbols/APIs first deprecated in SDK 13.1 have been removed
49 #define NTV2_DEPRECATE_14_0 // Do not undefine -- all symbols/APIs first deprecated in SDK 14.0 have been removed
50 #define NTV2_DEPRECATE_14_1 // Do not undefine -- all symbols/APIs first deprecated in SDK 14.1 (never released) have been removed
51 #define NTV2_DEPRECATE_14_2 // Do not undefine -- all symbols/APIs first deprecated in SDK 14.2 have been removed
52 #define NTV2_DEPRECATE_14_3 // Do not undefine -- all symbols/APIs first deprecated in SDK 14.3 have been removed
53 #define NTV2_DEPRECATE_15_0 // Do not undefine -- all symbols/APIs first deprecated in SDK 15.0 have been removed
54 #define NTV2_DEPRECATE_15_1 // Do not undefine -- all symbols/APIs first deprecated in SDK 15.1 have been removed
55 #define NTV2_DEPRECATE_15_2 // Do not undefine -- all symbols/APIs first deprecated in SDK 15.2 have been removed
56 #define NTV2_DEPRECATE_15_3 // Do not undefine -- all symbols/APIs first deprecated in SDK 15.3 (never released) have been removed
57 #define NTV2_DEPRECATE_15_5 // Do not undefine -- all symbols/APIs first deprecated in SDK 15.5 have been removed
58 #define NTV2_DEPRECATE_15_6 // Do not undefine -- all symbols/APIs first deprecated in SDK 15.6 (never released) have been removed
59 //#define NTV2_DEPRECATE_16_0 // If defined, excludes all symbols/APIs first deprecated in SDK 16.0
60 //#define NTV2_DEPRECATE_16_1 // If defined, excludes all symbols/APIs first deprecated in SDK 16.1
61 //#define NTV2_DEPRECATE_16_2 // If defined, excludes all symbols/APIs first deprecated in SDK 16.2
62 //#define NTV2_DEPRECATE_16_3 // If defined, excludes all symbols/APIs first deprecated in SDK 16.3 (never released)
63 //#define NTV2_DEPRECATE_17_0 // If defined, excludes all symbols/APIs first deprecated in SDK 17.0
64 //#define NTV2_DEPRECATE_17_1 // If defined, excludes all symbols/APIs first deprecated in SDK 17.1
65 //#define NTV2_DEPRECATE_17_2 // If defined, excludes all symbols/APIs first deprecated in SDK 17.2 (never released)
66 //#define NTV2_DEPRECATE_17_5 // If defined, excludes all symbols/APIs first deprecated in SDK 17.5
67 //#define NTV2_DEPRECATE_17_6 // If defined, excludes all symbols/APIs first deprecated in SDK 17.6
68 //#define NTV2_DEPRECATE_18_0 // If defined, excludes all symbols/APIs first deprecated in SDK 18.0
69 
70 
75 
76 /**************************************************************************************************************
77  NTV2_NULL_DEVICE When undefined (the default), the platform-specific implementations of
78  OpenLocalPhysical are included in the build, making it possible to connect to
79  locally-attached physical devices via the NTV2 kernel driver.
80 
81  When defined, all platform-specific implementations of OpenLocalPhysical are
82  omitted from the build, making it impossible to connect to locally-attached
83  physical devices via the NTV2 kernel driver. (Only remote or software/virtual
84  devices will be able to be opened via OpenRemote.) Note that MacOS clients
85  built with this defined can be "sandboxed".
86 
87  See also NTV2_MACOS_SANDBOX macro (below).
88 
89  Introduced in SDK 12.4.
90 **************************************************************************************************************/
91 //#define NTV2_NULL_DEVICE
92 
93 
94 /**************************************************************************************************************
95  NTV2_NUB_CLIENT_SUPPORT Deprecated in SDK 17.1
96 
97  When defined (the default), the SDK will load and connect to AJA-authorized
98  plugins to support remote or software/virtual NTV2 devices.
99 
100  When undefined, the SDK cannot talk to remote or software/virtual devices.
101 
102  NOTE: In a future SDK, this macro will be eliminated, and it won't be possible
103  to build the SDK without the capability of connecting to AJA-authorized remote
104  or software/virtual NTV2 devices.
105 
106  SDK 16.x - 17.0: Defined by default. This allowed the SDK to connect to
107  unauthenticated remote or software/virtual NTV2 devices.
108 
109  SDK 12.4 - 15.5, this macro was defined by default, allowing the SDK to connect
110  (only) to remote devices via the TCP/IP "nub". (The SDK had no software/virtual
111  device capability before SDK 16.0.)
112 
113  Introduced in SDK 12.4.
114 **************************************************************************************************************/
115 #define NTV2_NUB_CLIENT_SUPPORT
116 
117 
118 /**************************************************************************************************************
119  NTV2_WRITEREG_PROFILING When defined (the default), calls to WriteRegister can be profiled, and
120  CNTV2Card's WriteRegister profiling API is available.
121 
122  When undefined, WriteRegister calls cannot be profiled, and CNTV2Card's
123  WriteRegister profiling API is unavailable.
124 
125  Introduced in SDK 15.1.
126 **************************************************************************************************************/
127 #define NTV2_WRITEREG_PROFILING
128 
129 
130 /**************************************************************************************************************
131  NTV2_USE_CPLUSPLUS11 When defined (the default), the 'ajantv2' portion of the SDK will use C++
132  language and/or STL features that require a C++11 compiler.
133 
134  When undefined, the 'ajantv2' portion of the SDK will not use C++11 features.
135 
136  NOTE: This macro will be deprecated in a future SDK, when it will no longer
137  be possible to build the SDK without a C++11-capable compiler.
138 
139  See also: AJA_USE_CPLUSPLUS11 in 'ajabase/include/types.h'
140 
141  Introduced in SDK 16.0.
142 **************************************************************************************************************/
143 #if !defined(NTV2_USE_CPLUSPLUS11)
144  #define NTV2_USE_CPLUSPLUS11
145 #endif // !defined(NTV2_USE_CPLUSPLUS11)
146 
147 
148 /**************************************************************************************************************
149  NTV2_ALLOW_OPEN_UNSUPPORTED When undefined (the default), unsupported physical devices (see the
150  NTV2GetSupportedDevices utility function) that are attached to the local
151  host cannot be opened (via OpenLocalPhysical).
152 
153  When defined, unsupported physical devices that are attached to the local
154  host will be opened (via OpenLocalPhysical).
155 
156  See also: AJA_USE_CPLUSPLUS11 in 'ajabase/include/types.h'
157 
158  Introduced in SDK 17.0.
159 **************************************************************************************************************/
160 //#define NTV2_ALLOW_OPEN_UNSUPPORTED
161 
162 
163 /**************************************************************************************************************
164  NTV2_MACOS_SANDBOX When undefined (the default), the MacOS implementation of OpenLocalPhysical
165  will open connected AJA devices using either AJA's IOKit kernel extension ('KEXT')
166  or AJA's newer DriverKit driver ('DEXT'), whichever is installed.
167 
168  When defined, MacDriverInterface::OpenLocalPhysical will open connected AJA
169  devices ONLY using the DriverKit driver ('DEXT'), making it possible to "sandbox"
170  the client executable/application.
171 
172  (NOTE: If NTV2_NULL_DEVICE is defined, this macro is irrelevant.)
173 
174  Introduced in SDK 18.0.
175 **************************************************************************************************************/
176 //#define NTV2_MACOS_SANDBOX
177 
178 
179 
183 #define AJA_VIRTUAL virtual // Force use of virtual functions in CNTV2Card, etc.
184 #define AJA_STATIC static // Do not change this.
185 #define NTV2_UNUSED(__p__) (void)__p__
186 
187 #if defined(__CPLUSPLUS__) || defined(__cplusplus)
188  #if defined(AJAMac)
189  #if defined(__clang__)
190  #ifndef __has_feature
191  #define __has_feature(__x__) 0
192  #endif
193  #if __has_feature(cxx_nullptr)
194  #define AJA_CXX11_NULLPTR_AVAILABLE
195  #endif
196  #endif
197  #elif defined(AJALinux)
198  #if defined(__clang__)
199  #ifndef __has_feature
200  #define __has_feature(__x__) 0
201  #endif
202  #if __has_feature(cxx_nullptr)
203  #define AJA_CXX11_NULLPTR_AVAILABLE
204  #endif
205  #elif defined(__GNUC__)
206  #if __cplusplus >= 201103L // C++11 or later
207  #define AJA_CXX11_NULLPTR_AVAILABLE
208  #endif
209  #endif
210  #elif defined(MSWindows)
211  #if defined(_MSC_VER) && _MSC_VER >= 1700 // VS2012 or later:
212  #define AJA_CXX11_NULLPTR_AVAILABLE
213  #endif
214  #endif
215 #endif
216 
217 #if defined(AJA_CXX11_NULLPTR_AVAILABLE)
218  #define AJA_NULL nullptr
219 #else
220  #define AJA_NULL NULL
221 #endif
222 
223 #if defined(__clang__)
224  #ifndef __has_cpp_attribute
225  #define __has_cpp_attribute(__x__) 0
226  #endif
227 
228  #if __has_cpp_attribute(clang::fallthrough)
229  #define AJA_FALL_THRU [[clang::fallthrough]]
230  #else
231  #define AJA_FALL_THRU
232  #endif
233 #elif defined(__GNUC__)
234  #if __GNUC__ >= 5
235  #define AJA_FALL_THRU [[gnu::fallthrough]]
236  #else
237  #define AJA_FALL_THRU
238  #endif
239 #else
240  #define AJA_FALL_THRU
241 #endif
242 
243 
244 #if defined (NTV2_USE_STDINT)
245  #if defined (MSWindows)
246  #define _WINSOCK_DEPRECATED_NO_WARNINGS 1
247  #if (_MSC_VER < 1300)
248  typedef signed char int8_t;
249  typedef signed short int16_t;
250  typedef signed int int32_t;
251  typedef unsigned char uint8_t;
252  typedef unsigned short uint16_t;
253  typedef unsigned int uint32_t;
254  #else
255  #if defined (NTV2_BUILDING_DRIVER)
256  typedef signed __int8 int8_t;
257  typedef signed __int16 int16_t;
258  typedef signed __int32 int32_t;
259  typedef unsigned __int8 uint8_t;
260  typedef unsigned __int16 uint16_t;
261  typedef unsigned __int32 uint32_t;
262  #else
263  #include <stdint.h>
264  #endif
265  #endif
266  typedef signed __int64 int64_t;
267  typedef unsigned __int64 uint64_t;
268  #else
269  #include <stdint.h>
270  #endif
271  typedef uint8_t UByte;
272  typedef int8_t SByte;
273  typedef int16_t Word;
274  typedef uint16_t UWord;
275  typedef int32_t LWord;
276  typedef uint32_t ULWord;
277  typedef uint32_t * PULWord;
278  typedef int64_t LWord64;
279  typedef uint64_t ULWord64;
280  typedef uint64_t Pointer64;
281 #else
282  typedef int LWord;
283  typedef unsigned int ULWord;
284  typedef unsigned int * PULWord;
285  typedef short Word;
286  typedef unsigned short UWord;
287  typedef unsigned char UByte;
288  typedef char SByte;
289 #endif
290 
291 // Platform dependent
293 #if defined (MSWindows)
294  #define _WINSOCK_DEPRECATED_NO_WARNINGS 1
296 
297  #if !defined (NTV2_BUILDING_DRIVER)
298  #ifndef WIN32_LEAN_AND_MEAN
299  #define WIN32_LEAN_AND_MEAN
300  #endif
301 
302  #include <Windows.h>
303 
304  #if defined(DeviceCapabilities)
305  #undef DeviceCapabilities
306  #endif
307  #endif
308  #include <Basetsd.h>
309  typedef unsigned char Boolean;
310  typedef __int64 LWord64;
311  typedef unsigned __int64 ULWord64;
312  typedef unsigned __int64 Pointer64;
313  typedef LWord Fixed_;
314  typedef bool BOOL_;
315  typedef UWord UWord_;
316 
317  typedef signed __int8 int8_t;
318  typedef signed __int16 int16_t;
319  typedef signed __int32 int32_t;
320  typedef signed __int64 int64_t;
321  typedef unsigned __int8 uint8_t;
322  typedef unsigned __int16 uint16_t;
323  typedef unsigned __int32 uint32_t;
324  typedef unsigned __int64 uint64_t;
325 
326  typedef UINT_PTR AJASocket;
327 
328  #define AJATargetBigEndian 0
329  #define AJAFUNC __FUNCTION__
330  #define NTV2_CPP_MIN(__x__,__y__) min((__x__),(__y__))
331  #define NTV2_CPP_MAX(__x__,__y__) max((__x__),(__y__))
332  #pragma warning(disable:4996) // Sadly MSVC bitches about DECLARING a deprecated function but not about USING one.
333 
335 #elif defined (AJAMac)
336  #include <stdint.h>
338  typedef short HANDLE;
339  typedef void* PVOID;
340  typedef unsigned int BOOL_;
341  typedef ULWord UWord_;
342  typedef int Fixed_;
343  typedef int AJASocket;
344 
345  #define AJATargetBigEndian 0
346  #define AJAFUNC __func__
347  #define NTV2_CPP_MIN(__x__,__y__) std::min((__x__),(__y__))
348  #define NTV2_CPP_MAX(__x__,__y__) std::max((__x__),(__y__))
349 
350  #define MAX_PATH 4096
351 
352  #define INVALID_HANDLE_VALUE (0)
353 
354  #if !defined (NTV2_DEPRECATE)
355  typedef struct {
356  int cx;
357  int cy;
358  } SIZE;
359  #endif // !defined (NTV2_DEPRECATE)
360 
361  #define POINTER_32
362 
364 #elif defined (AJALinux)
365  /* As of kernel 2.6.19, the C type _Bool is typedefed to bool to allow
367  * generic booleans in the kernel. Unfortunately, we #define bool
368  * here and true and false there, so this fixes it ... until next time
369  * -JAC 3/6/2007 */
370  #ifdef __KERNEL__
371  #include "linux/version.h"
372  #include "linux/kernel.h"
373  #if defined (RHEL5) || (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19))
374  #include "linux/types.h"
375  #else/* LINUX_VERSION_CODE */
376  typedef unsigned char bool;
377  #endif /* LINUX_VERSION_CODE */
378  #endif /* __KERNEL__ */
379 
380  #if defined (MODULE)
381  #define NTV2_BUILDING_DRIVER
382  #undef NTV2_USE_CPLUSPLUS11
383  #endif
384 
385  #if !defined (NTV2_BUILDING_DRIVER)
386  #include <stdint.h>
387  typedef int64_t HANDLE;
388  typedef uint64_t ULWord64;
389  typedef uint64_t Pointer64;
390  typedef int64_t LWord64;
391  typedef void * PVOID;
392  typedef void * LPVOID;
393  typedef int32_t Fixed_;
394  typedef bool BOOL_;
395  typedef bool BOOL;
396  typedef UWord UWord_;
397  typedef uint32_t DWORD; /* 32 bits on 32 or 64 bit CPUS */
398 
399  typedef int32_t AJASocket;
400  #define NTV2_CPP_MIN(__x__,__y__) std::min((__x__),(__y__))
401  #define NTV2_CPP_MAX(__x__,__y__) std::max((__x__),(__y__))
402  #else
403  #if defined (AJAVirtual)
404  #include <stdbool.h>
405  #include <stdint.h>
406  #endif
407  typedef long HANDLE;
408  // this is what is is in Windows:
409  // typedef void * HANDLE;
410  typedef unsigned long long ULWord64;
411  typedef unsigned long long Pointer64;
412  typedef signed long long LWord64;
413  typedef void * PVOID;
414  typedef void * LPVOID;
415  typedef LWord Fixed_;
416  typedef bool BOOL_;
417  typedef bool BOOL;
418  typedef UWord UWord_;
419  typedef unsigned int DWORD; /* 32 bits on 32 or 64 bit CPUS */
420 
421  typedef int AJASocket;
422  #endif
423 
424  #define AJATargetBigEndian 0
425  #define AJAFUNC __func__
426 
427  #if !defined (NTV2_DEPRECATE)
428  typedef struct {
429  int cx;
430  int cy;
431  } SIZE;
432  #endif // !defined (NTV2_DEPRECATE)
433 
434  typedef struct {
435  int left;
436  int right;
437  int top;
438  int bottom;
439  } RECT;
440 
441  #ifndef INVALID_HANDLE_VALUE
442  #define INVALID_HANDLE_VALUE (-1L)
443  #endif
444  #define WINAPI
445  #define POINTER_32
446  #define MAX_PATH 4096
447 #elif defined (AJA_BAREMETAL)
449  #include <stdint.h>
451  typedef short HANDLE;
452  typedef void* PVOID;
453  typedef unsigned int BOOL_;
454  typedef ULWord UWord_;
455  typedef int Fixed_;
456  typedef int AJASocket;
457 
458  #define AJATargetBigEndian 0
459  #define AJAFUNC __func__
460  #define NTV2_CPP_MIN(__x__,__y__) std::min((__x__),(__y__))
461  #define NTV2_CPP_MAX(__x__,__y__) std::max((__x__),(__y__))
462 
463  #define MAX_PATH 4096
464 
465  #undef NTV2_WRITEREG_PROFILING // disable register write profiling
466 
467  #define INVALID_HANDLE_VALUE (0)
468 
469  #if !defined (NTV2_DEPRECATE)
470  typedef struct {
471  int cx;
472  int cy;
473  } SIZE;
474  #endif // !defined (NTV2_DEPRECATE)
475 
476  #define POINTER_32
477 
478 #else
479  #error "IMPLEMENT OTHER PLATFORM"
481 
482 #endif // end OTHER PLATFORM
483 
484 #if defined (NTV2_BUILDING_DRIVER)
485  // The AJA NTV2 driver is always built without any deprecated types or functions:
486  #if !defined(NTV2_DEPRECATE_16_0)
487  #define NTV2_DEPRECATE_16_0
488  #endif
489  #if !defined(NTV2_DEPRECATE_16_1)
490  #define NTV2_DEPRECATE_16_1
491  #endif
492  #if !defined(NTV2_DEPRECATE_16_2)
493  #define NTV2_DEPRECATE_16_2
494  #endif
495  #if !defined(NTV2_DEPRECATE_16_3)
496  #define NTV2_DEPRECATE_16_3
497  #endif
498 #endif // defined (NTV2_BUILDING_DRIVER)
499 
500 
504 #if !defined (NTV2_ASSERT)
505  #if defined (NTV2_BUILDING_DRIVER)
506  // Kernel space NTV2_ASSERTs
507  #if defined (AJA_DEBUG) || defined (_DEBUG)
508  #if defined (MSWindows)
509  #define NTV2_ASSERT(_expr_) ASSERT (#_expr_)
510  #elif defined (AJAMac)
511  #define NTV2_ASSERT(_expr_) assert (_expr_)
512  #elif defined (AJALinux)
513  #define NTV2_ASSERT(_expr_) do {if (#_expr_) break; \
514  printk (KERN_EMERG "### NTV2_ASSERT '%s': %s: line %d: %s\n", \
515  __FILE__, __func__, __LINE__, #_expr_); dump_stack(); \
516  } while (0)
517  #else
518  #define NTV2_ASSERT(_expr_)
519  #endif
520  #else
521  #define NTV2_ASSERT(_expr_)
522  #endif
523  #else
524  // User space NTV2_ASSERTs
525  #if defined (AJA_DEBUG) || defined (_DEBUG)
526  #include <assert.h>
527  #define NTV2_ASSERT(_expr_) assert (_expr_)
528  #else
529  #define NTV2_ASSERT(_expr_) (void) (_expr_)
530  #endif
531  #endif // else !defined (NTV2_BUILDING_DRIVER)
532 #endif // if NTV2_ASSERT undefined
533 
534 
538 // These implement compile-time warnings for use of deprecated variables and functions
539 #define NTV2_DEPRECATED_INLINE // Just a marker/reminder
540 #define NTV2_DEPRECATED_FIELD // Just a marker/reminder
541 #define NTV2_DEPRECATED_VARIABLE // Just a marker/reminder
542 #define NTV2_DEPRECATED_TYPEDEF // Just a marker/reminder
543 #define NTV2_DEPRECATED_CLASS // Just a marker/reminder
544 #define NTV2_SHOULD_BE_DEPRECATED(__f__) __f__
545 #define NTV2_SHOULD_DEPRECATE(__f__) __f__
546 #define NTV2_MUST_DEPRECATE(__f__) __f__
547 #define NTV2_WILL_BE_DEPRECATED(__f__) __f__
548 #if defined(NTV2_BUILDING_DRIVER)
549  // Disable deprecation warnings in driver builds
550  #define NTV2_DEPRECATED_f(__f__) __f__
551  #define NTV2_DEPRECATED_v(__v__) __v__
552  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
553 #elif defined(_MSC_VER) && _MSC_VER >= 1600
554  // Use __declspec(deprecated) for MSVC
555  #define NTV2_DEPRECATED_f(__f__) __declspec(deprecated) __f__
556  #define NTV2_DEPRECATED_v(__v__) __v__
557  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
558 #elif defined(__clang__)
559  // Use __attribute__((deprecated)) for LLVM/Clang
560  #define NTV2_DEPRECATED_f(__f__) __f__ __attribute__((deprecated))
561  #define NTV2_DEPRECATED_v(__v__) __v__
562  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
563 #elif defined(__GNUC__)
564  #if __GNUC__ >= 4
565  // Use __attribute__((deprecated)) for GCC 4 or later
566  #define NTV2_DEPRECATED_f(__f__) __f__ __attribute__ ((deprecated))
567  #define NTV2_DEPRECATED_v(__v__) __v__
568  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
569  #else
570  // Disable deprecation warnings in GCC prior to GCC 4
571  #define NTV2_DEPRECATED_f(__f__) __f__
572  #define NTV2_DEPRECATED_v(__v__) __v__
573  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
574  #endif
575 #else
576  // Disable deprecation warnings
577  #define NTV2_DEPRECATED_f(__f__) __f__
578  #define NTV2_DEPRECATED_v(__v__) __v__
579  #define NTV2_DEPRECATED_vi(__v__, __i__) __v__ = (__i__)
580 #endif
581 
582 
583 #if !defined(BIT)
584  #if !defined(AJALinux)
585  #define BIT(_x_) (1u << (_x_))
586  #else // Linux:
587  // As of kernel 2.6.24, BIT is defined in the kernel source (linux/bitops.h).
588  // By making that definition match the one in the kernel source *exactly*
589  // we supress compiler warnings (thanks Shaun)
590  #define BIT(nr) (1UL << (nr))
591  #endif // AJALinux
592 #endif
593 #if 1
594  #define BIT_0 (1u<<0)
595  #define BIT_1 (1u<<1)
596  #define BIT_2 (1u<<2)
597  #define BIT_3 (1u<<3)
598  #define BIT_4 (1u<<4)
599  #define BIT_5 (1u<<5)
600  #define BIT_6 (1u<<6)
601  #define BIT_7 (1u<<7)
602  #define BIT_8 (1u<<8)
603  #define BIT_9 (1u<<9)
604  #define BIT_10 (1u<<10)
605  #define BIT_11 (1u<<11)
606  #define BIT_12 (1u<<12)
607  #define BIT_13 (1u<<13)
608  #define BIT_14 (1u<<14)
609  #define BIT_15 (1u<<15)
610  #define BIT_16 (1u<<16)
611  #define BIT_17 (1u<<17)
612  #define BIT_18 (1u<<18)
613  #define BIT_19 (1u<<19)
614  #define BIT_20 (1u<<20)
615  #define BIT_21 (1u<<21)
616  #define BIT_22 (1u<<22)
617  #define BIT_23 (1u<<23)
618  #define BIT_24 (1u<<24)
619  #define BIT_25 (1u<<25)
620  #define BIT_26 (1u<<26)
621  #define BIT_27 (1u<<27)
622  #define BIT_28 (1u<<28)
623  #define BIT_29 (1u<<29)
624  #define BIT_30 (1u<<30)
625  #define BIT_31 (1u<<31)
626 #endif // 1
627 
628 #if 0
629 // Check at compile time if all the defined types are the correct size
630 // must support C++11 for this to work
631 static_assert(sizeof(bool) == 1, "bool: size is not correct");
632 static_assert(sizeof(int8_t) == 1, "int8_t: size is not correct");
633 static_assert(sizeof(int16_t) == 2, "int16_t: size is not correct");
634 static_assert(sizeof(int32_t) == 4, "int32_t: size is not correct");
635 static_assert(sizeof(int64_t) == 8, "int64_t: size is not correct");
636 static_assert(sizeof(uint8_t) == 1, "uint8_t: size is not correct");
637 static_assert(sizeof(uint16_t) == 2, "uint16_t: size is not correct");
638 static_assert(sizeof(uint32_t) == 4, "uint32_t: size is not correct");
639 static_assert(sizeof(uint64_t) == 8, "uint64_t: size is not correct");
640 
641 static_assert(sizeof(LWord) == 4, "LWord: size is not correct");
642 static_assert(sizeof(ULWord) == 4, "ULWord: size is not correct");
643 static_assert(sizeof(PULWord) == 8, "PULWord: size is not correct");
644 static_assert(sizeof(Word) == 2, "Word: size is not correct");
645 static_assert(sizeof(UWord) == 2, "UWord: size is not correct");
646 static_assert(sizeof(UByte) == 1, "UByte: size is not correct");
647 static_assert(sizeof(SByte) == 1, "SByte: size is not correct");
648 
649 static_assert(sizeof(ULWord64) == 8, "ULWord64: size is not correct");
650 static_assert(sizeof(Pointer64) == 8, "Pointer64: size is not correct");
651 static_assert(sizeof(LWord64) == 8, "LWord64: size is not correct");
652 static_assert(sizeof(PVOID) == 8, "PVOID: size is not correct");
653 static_assert(sizeof(Fixed_) == 4, "Fixed_: size is not correct");
654 
655 // ideally these whould be the same across the platforms but historically they have not been
656 #if defined(MSWindows)
657 static_assert(sizeof(HANDLE) == 8, "HANDLE: size is not correct");
658 static_assert(sizeof(BOOL) == 4, "BOOL: size is not correct");
659 static_assert(sizeof(BOOL_) == 1, "BOOL_: size is not correct");
660 static_assert(sizeof(AJASocket) == 8, "AJASocket: size is not correct");
661 static_assert(sizeof(UWord_) == 2, "UWord_: size is not correct");
662 static_assert(sizeof(LPVOID) == 8, "LPVOID: size is not correct");
663 static_assert(sizeof(DWORD) == 4, "DWORD: size is not correct");
664 #elif defined(AJAMac)
665 static_assert(sizeof(HANDLE) == 2, "HANDLE: size is not correct");
666 //static_assert(sizeof(BOOL) == 1, "BOOL: size is not correct");
667 static_assert(sizeof(BOOL_) == 4, "BOOL_: size is not correct");
668 static_assert(sizeof(AJASocket) == 4, "AJASocket: size is not correct");
669 static_assert(sizeof(UWord_) == 4, "UWord_: size is not correct");
670 //static_assert(sizeof(LPVOID) == 8, "LPVOID: size is not correct");
671 //static_assert(sizeof(DWORD) == 4, "DWORD: size is not correct");
672 #elif defined(AJALinux)
673 static_assert(sizeof(HANDLE) == 8, "HANDLE: size is not correct");
674 static_assert(sizeof(BOOL) == 1, "BOOL: size is not correct");
675 static_assert(sizeof(BOOL_) == 1, "BOOL_: size is not correct");
676 static_assert(sizeof(AJASocket) == 4, "AJASocket: size is not correct");
677 static_assert(sizeof(UWord_) == 2, "UWord_: size is not correct");
678 static_assert(sizeof(LPVOID) == 8, "LPVOID: size is not correct");
679 static_assert(sizeof(DWORD) == 4, "DWORD: size is not correct");
680 #endif
681 
682 #endif
683 
684 #endif // AJATYPES_H
SByte
int8_t SByte
Definition: ajatypes.h:272
LWord
int32_t LWord
Definition: ajatypes.h:275
HANDLE
short HANDLE
Definition: ajatypes.h:338
PULWord
uint32_t * PULWord
Definition: ajatypes.h:277
BOOL_
unsigned int BOOL_
Definition: ajatypes.h:340
ULWord
uint32_t ULWord
Definition: ajatypes.h:276
Pointer64
uint64_t Pointer64
Definition: ajatypes.h:280
UWord
uint16_t UWord
Definition: ajatypes.h:274
PVOID
void * PVOID
Definition: ajatypes.h:339
Word
int16_t Word
Definition: ajatypes.h:273
UWord_
ULWord UWord_
Definition: ajatypes.h:341
LWord64
int64_t LWord64
Definition: ajatypes.h:278
AJASocket
int AJASocket
Definition: ajatypes.h:343
UByte
uint8_t UByte
Definition: ajatypes.h:271
ULWord64
uint64_t ULWord64
Definition: ajatypes.h:279
Fixed_
int Fixed_
Definition: ajatypes.h:342