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