Mercurial > hg > orthanc
annotate OrthancFramework/Sources/Endianness.h @ 5644:343149762476
fix build with DCMTK <= 3.6.6
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 31 May 2024 18:23:44 +0200 |
parents | f7adfb22e20e |
children |
rev | line source |
---|---|
1938 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5432
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1938 | 8 * |
9 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 * the License, or (at your option) any later version. |
1938 | 13 * |
14 * This program is distributed in the hope that it will be useful, but | |
15 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * Lesser General Public License for more details. |
1938 | 18 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
21 * <http://www.gnu.org/licenses/>. |
1938 | 22 **/ |
23 | |
24 | |
25 #pragma once | |
26 | |
27 | |
28 /******************************************************************** | |
2407
5edec967055e
fix sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
29 ** LINUX-LIKE ARCHITECTURES |
1938 | 30 ********************************************************************/ |
31 | |
2448
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
32 #if defined(__LSB_VERSION__) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
33 // Linux Standard Base (LSB) does not come with be16toh, be32toh, and |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
34 // be64toh |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
35 # define ORTHANC_HAS_BUILTIN_BYTE_SWAP 0 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
36 # include <endian.h> |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
37 #elif defined(__linux__) || defined(__EMSCRIPTEN__) |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
38 # define ORTHANC_HAS_BUILTIN_BYTE_SWAP 1 |
1938 | 39 # include <endian.h> |
40 #endif | |
41 | |
42 | |
43 /******************************************************************** | |
44 ** WINDOWS ARCHITECTURES | |
45 ** | |
1950
533ff46e944b
return a single raw frame from DICOM videos
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1939
diff
changeset
|
46 ** On Windows x86, "host" will always be little-endian ("le"). |
1938 | 47 ********************************************************************/ |
48 | |
49 #if defined(_WIN32) | |
50 # if defined(_MSC_VER) | |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
51 // Visual Studio - http://msdn.microsoft.com/en-us/library/a3140177.aspx |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
52 # define ORTHANC_HAS_BUILTIN_BYTE_SWAP 1 |
1938 | 53 # define be16toh(x) _byteswap_ushort(x) |
54 # define be32toh(x) _byteswap_ulong(x) | |
55 # define be64toh(x) _byteswap_uint64(x) | |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
56 # elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
57 // MinGW >= 4.3 - Use builtin intrinsic for byte swapping |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
58 # define ORTHANC_HAS_BUILTIN_BYTE_SWAP 1 |
1938 | 59 # define be16toh(x) __builtin_bswap16(x) |
60 # define be32toh(x) __builtin_bswap32(x) | |
61 # define be64toh(x) __builtin_bswap64(x) | |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
62 # else |
2546 | 63 // MinGW <= 4.2, we must manually implement the byte swapping (*) |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
64 # define ORTHANC_HAS_BUILTIN_BYTE_SWAP 0 |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
65 # define be16toh(x) __orthanc_bswap16(x) |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
66 # define be32toh(x) __orthanc_bswap32(x) |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
67 # define be64toh(x) __orthanc_bswap64(x) |
1938 | 68 # endif |
69 | |
70 # define htobe16(x) be16toh(x) | |
71 # define htobe32(x) be32toh(x) | |
72 # define htobe64(x) be64toh(x) | |
73 | |
74 # define htole16(x) x | |
75 # define htole32(x) x | |
76 # define htole64(x) x | |
77 | |
78 # define le16toh(x) x | |
79 # define le32toh(x) x | |
80 # define le64toh(x) x | |
81 #endif | |
82 | |
83 | |
84 /******************************************************************** | |
85 ** FREEBSD ARCHITECTURES | |
86 ********************************************************************/ | |
87 | |
88 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) | |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
89 # define ORTHANC_HAS_BUILTIN_BYTE_SWAP 1 |
1938 | 90 # include <arpa/inet.h> |
91 #endif | |
92 | |
93 | |
94 /******************************************************************** | |
2459
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
95 ** OPENBSD ARCHITECTURES |
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
96 ********************************************************************/ |
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
97 |
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
98 #if defined(__OpenBSD__) |
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
99 # define ORTHANC_HAS_BUILTIN_BYTE_SWAP 1 |
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
100 # include <endian.h> |
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
101 #endif |
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
102 |
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
103 |
98a04e75f15e
endianness in openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2448
diff
changeset
|
104 /******************************************************************** |
1938 | 105 ** APPLE ARCHITECTURES (including OS X) |
106 ********************************************************************/ | |
107 | |
108 #if defined(__APPLE__) | |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
109 # define ORTHANC_HAS_BUILTIN_BYTE_SWAP 1 |
1938 | 110 # include <libkern/OSByteOrder.h> |
111 # define be16toh(x) OSSwapBigToHostInt16(x) | |
112 # define be32toh(x) OSSwapBigToHostInt32(x) | |
113 # define be64toh(x) OSSwapBigToHostInt64(x) | |
114 | |
115 # define htobe16(x) OSSwapHostToBigInt16(x) | |
116 # define htobe32(x) OSSwapHostToBigInt32(x) | |
117 # define htobe64(x) OSSwapHostToBigInt64(x) | |
118 | |
119 # define htole16(x) OSSwapHostToLittleInt16(x) | |
120 # define htole32(x) OSSwapHostToLittleInt32(x) | |
121 # define htole64(x) OSSwapHostToLittleInt64(x) | |
122 | |
123 # define le16toh(x) OSSwapLittleToHostInt16(x) | |
124 # define le32toh(x) OSSwapLittleToHostInt32(x) | |
125 # define le64toh(x) OSSwapLittleToHostInt64(x) | |
126 #endif | |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
127 |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
128 |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
129 /******************************************************************** |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
130 ** PORTABLE (BUT SLOW) IMPLEMENTATION OF BYTE-SWAPPING |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
131 ********************************************************************/ |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
132 |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
133 #if ORTHANC_HAS_BUILTIN_BYTE_SWAP != 1 |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
134 |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
135 #include <stdint.h> |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
136 |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
137 static inline uint16_t __orthanc_bswap16(uint16_t a) |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
138 { |
2807
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
139 /** |
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
140 * Note that an alternative implementation was included in Orthanc |
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
141 * 1.4.0 and 1.4.1: |
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
142 * |
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
143 * # hg log -p -r 2706 |
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
144 * |
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
145 * This alternative implementation only hid an underlying problem |
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
146 * with pointer alignment on some architectures, and was thus |
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
147 * reverted. Check out issue #99: |
5432
59e3b6f8c5be
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
148 * https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=99 |
2807
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
149 **/ |
6356e2ceb493
Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2707
diff
changeset
|
150 return (a << 8) | (a >> 8); |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
151 } |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
152 |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
153 static inline uint32_t __orthanc_bswap32(uint32_t a) |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
154 { |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
155 const uint8_t* p = reinterpret_cast<const uint8_t*>(&a); |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
156 return (static_cast<uint32_t>(p[0]) << 24 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
157 static_cast<uint32_t>(p[1]) << 16 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
158 static_cast<uint32_t>(p[2]) << 8 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
159 static_cast<uint32_t>(p[3])); |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
160 } |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
161 |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
162 static inline uint64_t __orthanc_bswap64(uint64_t a) |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
163 { |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
164 const uint8_t* p = reinterpret_cast<const uint8_t*>(&a); |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
165 return (static_cast<uint64_t>(p[0]) << 56 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
166 static_cast<uint64_t>(p[1]) << 48 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
167 static_cast<uint64_t>(p[2]) << 40 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
168 static_cast<uint64_t>(p[3]) << 32 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
169 static_cast<uint64_t>(p[4]) << 24 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
170 static_cast<uint64_t>(p[5]) << 16 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
171 static_cast<uint64_t>(p[6]) << 8 | |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
172 static_cast<uint64_t>(p[7])); |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
173 } |
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
174 |
2546 | 175 #if defined(_WIN32) |
176 // Implemented above (*) | |
177 #elif defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN) | |
2448
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
178 # if __BYTE_ORDER == __LITTLE_ENDIAN |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
179 # define be16toh(x) __orthanc_bswap16(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
180 # define be32toh(x) __orthanc_bswap32(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
181 # define be64toh(x) __orthanc_bswap64(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
182 # define htobe16(x) __orthanc_bswap16(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
183 # define htobe32(x) __orthanc_bswap32(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
184 # define htobe64(x) __orthanc_bswap64(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
185 # define htole16(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
186 # define htole32(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
187 # define htole64(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
188 # define le16toh(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
189 # define le32toh(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
190 # define le64toh(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
191 # elif __BYTE_ORDER == __BIG_ENDIAN |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
192 # define be16toh(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
193 # define be32toh(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
194 # define be64toh(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
195 # define htobe16(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
196 # define htobe32(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
197 # define htobe64(x) x |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
198 # define htole16(x) __orthanc_bswap16(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
199 # define htole32(x) __orthanc_bswap32(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
200 # define htole64(x) __orthanc_bswap64(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
201 # define le16toh(x) __orthanc_bswap16(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
202 # define le32toh(x) __orthanc_bswap32(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
203 # define le64toh(x) __orthanc_bswap64(x) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
204 # else |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
205 # error Please support your platform here |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
206 # endif |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
207 #else |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
208 # error Please support your platform here |
1971
869a87c08673
fix for mingw <= 4.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1950
diff
changeset
|
209 #endif |
2448
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
210 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
211 #endif |