Blame src/fcarch.h

Packit 352660
/*
Packit 352660
 * Copyright © 2006 Keith Packard
Packit 352660
 * Copyright © 2010 Behdad Esfahbod
Packit 352660
 *
Packit 352660
 * Permission to use, copy, modify, distribute, and sell this software and its
Packit 352660
 * documentation for any purpose is hereby granted without fee, provided that
Packit 352660
 * the above copyright notice appear in all copies and that both that
Packit 352660
 * copyright notice and this permission notice appear in supporting
Packit 352660
 * documentation, and that the name of the author(s) not be used in
Packit 352660
 * advertising or publicity pertaining to distribution of the software without
Packit 352660
 * specific, written prior permission.  The authors make no
Packit 352660
 * representations about the suitability of this software for any purpose.  It
Packit 352660
 * is provided "as is" without express or implied warranty.
Packit 352660
 *
Packit 352660
 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
Packit 352660
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
Packit 352660
 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
Packit 352660
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
Packit 352660
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
Packit 352660
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
Packit 352660
 * PERFORMANCE OF THIS SOFTWARE.
Packit 352660
 */
Packit 352660
#ifndef _FCARCH_H_
Packit 352660
#define _FCARCH_H_
Packit 352660
Packit 352660
#ifdef HAVE_CONFIG_H
Packit 352660
#include <config.h>
Packit 352660
#endif
Packit 352660
Packit 352660
/*
Packit 352660
 * Each unique machine architecture needs an entry in this file
Packit 352660
 * So far the differences boil down to: endianness, 32 vs 64 bit pointers,
Packit 352660
 * and on 32bit ones, whether double is aligned to one word or two words.
Packit 352660
 * Those result in the 6 formats listed below.
Packit 352660
 *
Packit 352660
 * If any of the assertion errors in fcarch.c fail, you need to add a new
Packit 352660
 * architecture.  Contact the fontconfig mailing list in that case.
Packit 352660
 *
Packit 352660
 * name		endianness	pointer-size	double-alignment
Packit 352660
 *
Packit 352660
 * le32d4	4321		4		4
Packit 352660
 * le32d8	4321		4		8
Packit 352660
 * le64		4321		8		8
Packit 352660
 * be32d4	1234		4		4
Packit 352660
 * be32d8	1234		4		8
Packit 352660
 * be64		1234		8		8
Packit 352660
 */
Packit 352660
Packit 352660
#if defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
Packit 352660
# define FC_ARCH_ENDIAN "le"
Packit 352660
#elif defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN
Packit 352660
# define FC_ARCH_ENDIAN "be"
Packit 352660
#elif defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER == __DARWIN_PDP_ENDIAN
Packit 352660
# define FC_ARCH_ENDIAN "pe"
Packit 352660
#elif defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN
Packit 352660
# define FC_ARCH_ENDIAN "be"
Packit 352660
#else
Packit 352660
# define FC_ARCH_ENDIAN "le"
Packit 352660
#endif
Packit 352660
Packit 352660
#if SIZEOF_VOID_P == 4
Packit 352660
# if ALIGNOF_DOUBLE == 4
Packit 352660
#  define FC_ARCH_SIZE_ALIGN "32d4"
Packit 352660
# else /* ALIGNOF_DOUBLE != 4 */
Packit 352660
#  define FC_ARCH_SIZE_ALIGN "32d8"
Packit 352660
# endif
Packit 352660
#else /* SIZEOF_VOID_P != 4 */
Packit 352660
# define FC_ARCH_SIZE_ALIGN "64"
Packit 352660
#endif
Packit 352660
Packit 352660
/* config.h might override this */
Packit 352660
#ifndef FC_ARCHITECTURE
Packit 352660
# define FC_ARCHITECTURE FC_ARCH_ENDIAN FC_ARCH_SIZE_ALIGN
Packit 352660
#endif
Packit 352660
Packit 352660
#endif /* _FCARCH_H_ */