equal
deleted
inserted
replaced
14 * You should have received a copy of the GNU General Public License |
14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software |
15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 */ |
17 */ |
18 |
18 |
19 #include <stdio.h> |
19 #include "globals.h" |
20 #include <stdlib.h> |
|
21 |
20 |
22 #ifndef _WIN32 |
|
23 #include <stdint.h> |
|
24 #else |
|
25 #include "winstdint.h" |
|
26 #endif |
|
27 |
21 |
28 #ifdef __CPLUSPLUS |
22 #ifdef __CPLUSPLUS |
29 extern "C" { |
23 extern "C" { |
30 #endif |
24 #endif |
31 |
25 |
32 #ifdef HAVE_BYTESWAP_H |
|
33 /* use byteswap macros from the host system, hopefully optimized ones ;-) */ |
|
34 #include <byteswap.h> |
|
35 #else |
|
36 /* define our own version, simple, stupid, straight-forward... */ |
|
37 |
|
38 #define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) |
|
39 |
|
40 #define bswap_32(x) ((((x) & 0xFF000000) >> 24) | \ |
|
41 (((x) & 0x00FF0000) >> 8) | \ |
|
42 (((x) & 0x0000FF00) << 8) | \ |
|
43 (((x) & 0x000000FF) << 24) ) |
|
44 |
|
45 #endif |
|
46 |
|
47 |
|
48 #pragma once |
26 #pragma once |
49 |
27 |
50 int invert_endianness(int number); |
28 int invert_endianness(int number); |
51 |
29 |
52 #ifdef __CPLUSPLUS |
30 #ifdef __CPLUSPLUS |