Commit | Line | Data |
---|---|---|
a0486bac | 1 | /* Interface to endianness-neutrality functions. |
b3adc24a | 2 | Copyright (C) 2019-2020 Free Software Foundation, Inc. |
a0486bac JM |
3 | |
4 | This file is part of libctf. | |
5 | ||
6 | libctf is free software; you can redistribute it and/or modify it under | |
7 | the terms of the GNU General Public License as published by the Free | |
8 | Software Foundation; either version 3, or (at your option) any later | |
9 | version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
14 | See the GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; see the file COPYING. If not see | |
18 | <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #ifndef _CTF_ENDIAN_H | |
21 | #define _CTF_ENDIAN_H | |
22 | ||
23 | #include "config.h" | |
24 | #include <stdint.h> | |
25 | #include "swap.h" | |
26 | ||
a2230b5e | 27 | #if !defined (HAVE_ENDIAN_H) || !defined (htole64) |
a0486bac | 28 | #ifndef WORDS_BIGENDIAN |
a2230b5e HPN |
29 | # define htole64(x) (x) |
30 | # define le64toh(x) (x) | |
a0486bac JM |
31 | #else |
32 | # define htole64(x) bswap_64 ((x)) | |
33 | # define le64toh(x) bswap_64 ((x)) | |
34 | #endif /* WORDS_BIGENDIAN */ | |
35 | #endif /* !defined(HAVE_ENDIAN_H) */ | |
36 | ||
37 | #endif /* !defined(_CTF_ENDIAN_H) */ |