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