chromium/third_party/libaom/source/libaom/aom_util/endian_inl.h

/*
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
//
// Endian related functions.

#ifndef AOM_AOM_UTIL_ENDIAN_INL_H_
#define AOM_AOM_UTIL_ENDIAN_INL_H_

#include <stdlib.h>

#include "config/aom_config.h"

#include "aom/aom_integer.h"

#if defined(__GNUC__)
#define LOCAL_GCC_VERSION
#define LOCAL_GCC_PREREQ(maj, min)
#else
#define LOCAL_GCC_VERSION
#define LOCAL_GCC_PREREQ
#endif

// handle clang compatibility
#ifndef __has_builtin
#define __has_builtin
#endif

// some endian fix (e.g.: mips-gcc doesn't define __BIG_ENDIAN__)
#if !defined(WORDS_BIGENDIAN) &&                   \
    (defined(__BIG_ENDIAN__) || defined(_M_PPC) || \
     (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)))
#define WORDS_BIGENDIAN
#endif

#if defined(WORDS_BIGENDIAN)
#define HToLE32
#define HToLE16
#define HToBE64
#define HToBE32
#else
#define HToLE32(x)
#define HToLE16(x)
#define HToBE64(X)
#define HToBE32(X)
#endif

#if LOCAL_GCC_PREREQ(4, 8) || __has_builtin(__builtin_bswap16)
#define HAVE_BUILTIN_BSWAP16
#endif

#if LOCAL_GCC_PREREQ(4, 3) || __has_builtin(__builtin_bswap32)
#define HAVE_BUILTIN_BSWAP32
#endif

#if LOCAL_GCC_PREREQ(4, 3) || __has_builtin(__builtin_bswap64)
#define HAVE_BUILTIN_BSWAP64
#endif

static inline uint16_t BSwap16(uint16_t x) {}

static inline uint32_t BSwap32(uint32_t x) {}

static inline uint64_t BSwap64(uint64_t x) {}

#endif  // AOM_AOM_UTIL_ENDIAN_INL_H_