AJA NTV2 SDK
17.1.3.1410
NTV2 SDK 17.1.3.1410
ntv2endian.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: MIT */
8
#ifndef NTV2ENDIAN_H
9
#define NTV2ENDIAN_H
10
11
#include "
ajatypes.h
"
12
13
// unconditional endian byte swap
14
15
#define NTV2EndianSwap16(__val__) \
16
( ((UWord(__val__)<<8) & 0xFF00) | \
17
((UWord(__val__)>>8) & 0x00FF) )
18
19
#define NTV2EndianSwap32(__val__) \
20
( ((ULWord(__val__)<<24) & 0xFF000000) | \
21
((ULWord(__val__)<< 8) & 0x00FF0000) | \
22
((ULWord(__val__)>> 8) & 0x0000FF00) | \
23
((ULWord(__val__)>>24) & 0x000000FF) )
24
25
#define NTV2EndianSwap64(__val__) \
26
( ((ULWord64(__val__)<<56) & 0xFF00000000000000ULL) | \
27
((ULWord64(__val__)<<40) & 0x00FF000000000000ULL) | \
28
((ULWord64(__val__)<<24) & 0x0000FF0000000000ULL) | \
29
((ULWord64(__val__)<< 8) & 0x000000FF00000000ULL) | \
30
((ULWord64(__val__)>> 8) & 0x00000000FF000000ULL) | \
31
((ULWord64(__val__)>>24) & 0x0000000000FF0000ULL) | \
32
((ULWord64(__val__)>>40) & 0x000000000000FF00ULL) | \
33
((ULWord64(__val__)>>56) & 0x00000000000000FFULL) )
34
35
36
#if AJATargetBigEndian // BigEndian (BE) target host
37
38
#define NTV2HostIsBigEndian (true)
39
40
// BigEndian-to-host (NetworkByteOrder-to-host) (native)
41
#define NTV2EndianSwap16BtoH(__val__) (__val__)
42
#define NTV2EndianSwap16HtoB(__val__) (__val__)
43
#define NTV2EndianSwap32BtoH(__val__) (__val__)
44
#define NTV2EndianSwap32HtoB(__val__) (__val__)
45
#define NTV2EndianSwap64BtoH(__val__) (__val__)
46
#define NTV2EndianSwap64HtoB(__val__) (__val__)
47
48
// LittleEndian-to-host (translate)
49
#define NTV2EndianSwap16LtoH(__val__) NTV2EndianSwap16(__val__)
50
#define NTV2EndianSwap16HtoL(__val__) NTV2EndianSwap16(__val__)
51
#define NTV2EndianSwap32LtoH(__val__) NTV2EndianSwap32(__val__)
52
#define NTV2EndianSwap32HtoL(__val__) NTV2EndianSwap32(__val__)
53
#define NTV2EndianSwap64LtoH(__val__) NTV2EndianSwap64(__val__)
54
#define NTV2EndianSwap64HtoL(__val__) NTV2EndianSwap64(__val__)
55
56
#else // LittleEndian (LE) target host
57
58
#define NTV2HostIsBigEndian (false)
59
60
// BigEndian-to-host (NetworkByteOrder-to-host) (translate)
61
#define NTV2EndianSwap16BtoH(__val__) NTV2EndianSwap16(__val__)
62
#define NTV2EndianSwap16HtoB(__val__) NTV2EndianSwap16(__val__)
63
#define NTV2EndianSwap32BtoH(__val__) NTV2EndianSwap32(__val__)
64
#define NTV2EndianSwap32HtoB(__val__) NTV2EndianSwap32(__val__)
65
#define NTV2EndianSwap64BtoH(__val__) NTV2EndianSwap64(__val__)
66
#define NTV2EndianSwap64HtoB(__val__) NTV2EndianSwap64(__val__)
67
68
// LittleEndian-to-host (native)
69
#define NTV2EndianSwap16LtoH(__val__) (__val__)
70
#define NTV2EndianSwap16HtoL(__val__) (__val__)
71
#define NTV2EndianSwap32LtoH(__val__) (__val__)
72
#define NTV2EndianSwap32HtoL(__val__) (__val__)
73
#define NTV2EndianSwap64LtoH(__val__) (__val__)
74
#define NTV2EndianSwap64HtoL(__val__) (__val__)
75
76
#endif
77
78
#endif // NTV2ENDIAN_H
ajatypes.h
Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal devel...
libajantv2
ajantv2
includes
ntv2endian.h
Generated on Tue Dec 3 2024 10:25:59 for AJA NTV2 SDK by
1.8.17