Home | History | Annotate | Line # | Download | only in libctf
ctf-endian.h revision 1.5
      1  1.1  christos /* Interface to endianness-neutrality functions.
      2  1.5  christos    Copyright (C) 2019-2025 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.2  christos #if !defined (HAVE_ENDIAN_H)
     28  1.2  christos # ifndef WORDS_BIGENDIAN
     29  1.2  christos #  ifndef htole64
     30  1.2  christos #   define htole64(x) (x)
     31  1.2  christos #  endif
     32  1.2  christos #  ifndef le64toh
     33  1.2  christos #   define le64toh(x) (x)
     34  1.2  christos #  endif
     35  1.2  christos # else
     36  1.2  christos #  ifndef htole64
     37  1.2  christos #   define htole64(x) bswap_64 ((x))
     38  1.2  christos #  endif
     39  1.2  christos #  ifndef le64toh
     40  1.2  christos #   define le64toh(x) bswap_64 ((x))
     41  1.2  christos #  endif
     42  1.2  christos # endif /* WORDS_BIGENDIAN */
     43  1.1  christos #endif /* !defined(HAVE_ENDIAN_H) */
     44  1.1  christos 
     45  1.1  christos #endif /* !defined(_CTF_ENDIAN_H) */
     46