Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
BaConfigEndian.h
1
/*
2
* ____ _________ __ _
3
* / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4
* / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5
* / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6
* /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7
* /____/
8
*
9
* Barracuda Embedded Web-Server
10
*
11
****************************************************************************
12
* HEADER
13
*
14
* $Id: BaConfigEndian.h 6691 2026-10-30 15:54:46Z wini $
15
*
16
* COPYRIGHT: Real Time Logic LLC, 2023 - 2026
17
*
18
* This software is copyrighted by and is the sole property of Real
19
* Time Logic LLC. All rights, title, ownership, or other interests in
20
* the software remain the property of Real Time Logic LLC. This
21
* software may only be used in accordance with the terms and
22
* conditions stipulated in the corresponding license agreement under
23
* which the software has been supplied. Any unauthorized use,
24
* duplication, transmission, distribution, or disclosure of this
25
* software is expressly forbidden.
26
*
27
* This Copyright notice may not be removed or modified without prior
28
* written consent of Real Time Logic LLC.
29
*
30
* Real Time Logic LLC. reserves the right to modify this software
31
* without notice.
32
*
33
* http://www.realtimelogic.com
34
****************************************************************************
35
*
36
* Resolve and validate native byte order after the port has established its
37
* facts. This macro-only header also supports BAS assembly and build probes.
38
*/
39
#ifndef _BaConfigEndian_h
40
#define _BaConfigEndian_h
41
#include <BaConfigDefs.h>
42
43
#ifndef BA_INTERNAL_CONFIG_OPTS_LOADED
44
#define BA_INTERNAL_CONFIG_OPTS_LOADED 1
45
#include <BaConfigOpts.h>
46
#endif
47
48
/* Application options may select byte order, but cannot change its constants. */
49
#if BA_BYTE_ORDER_LITTLE_ENDIAN != 1234
50
#error BA_BYTE_ORDER_LITTLE_ENDIAN must be 1234
51
#endif
52
#if BA_BYTE_ORDER_BIG_ENDIAN != 4321
53
#error BA_BYTE_ORDER_BIG_ENDIAN must be 4321
54
#endif
55
56
#if defined(B_LITTLE_ENDIAN) || defined(B_BIG_ENDIAN)
57
#error Replace legacy endian flags with BA_BYTE_ORDER
58
#endif
59
60
/* Compiler facts are independent of an explicit application selection. */
61
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)
62
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
63
#define BA_INTERNAL_COMPILER_BYTE_ORDER 1234
64
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
65
#define BA_INTERNAL_COMPILER_BYTE_ORDER 4321
66
#else
67
#error Unsupported compiler byte order
68
#endif
69
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64))
70
#define BA_INTERNAL_COMPILER_BYTE_ORDER 1234
71
#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
72
#define BA_INTERNAL_COMPILER_BYTE_ORDER 1234
73
#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
74
#define BA_INTERNAL_COMPILER_BYTE_ORDER 4321
75
#elif defined(__CC_ARM) && defined(__ARM_BIG_ENDIAN)
76
#define BA_INTERNAL_COMPILER_BYTE_ORDER 4321
77
#elif defined(__CC_ARM)
78
#define BA_INTERNAL_COMPILER_BYTE_ORDER 1234
79
#endif
80
81
#ifndef BA_BYTE_ORDER
82
#if defined(BA_INTERNAL_COMPILER_BYTE_ORDER) && BA_INTERNAL_COMPILER_BYTE_ORDER == 1234
83
#define BA_BYTE_ORDER BA_BYTE_ORDER_LITTLE_ENDIAN
84
#elif defined(BA_INTERNAL_COMPILER_BYTE_ORDER) && BA_INTERNAL_COMPILER_BYTE_ORDER == 4321
85
#define BA_BYTE_ORDER BA_BYTE_ORDER_BIG_ENDIAN
86
#else
87
#error The port must define BA_BYTE_ORDER
88
#endif
89
#endif
90
91
#if BA_BYTE_ORDER != BA_BYTE_ORDER_LITTLE_ENDIAN && BA_BYTE_ORDER != BA_BYTE_ORDER_BIG_ENDIAN
92
#error BA_BYTE_ORDER must select LITTLE_ENDIAN or BIG_ENDIAN
93
#endif
94
#if defined(BA_INTERNAL_COMPILER_BYTE_ORDER) && BA_BYTE_ORDER != BA_INTERNAL_COMPILER_BYTE_ORDER
95
#error BA_BYTE_ORDER disagrees with the compiler
96
#endif
97
#undef BA_INTERNAL_COMPILER_BYTE_ORDER
98
99
#endif
/* _BaConfigEndian_h */
inc
BaConfigEndian.h
Barracuda Application Server
C/C++ reference | Doxygen 1.9.4