1229109Sed/* ===-- int_lib.h - configuration header for compiler-rt -----------------=== 2229109Sed * 3229109Sed * The LLVM Compiler Infrastructure 4229109Sed * 5229109Sed * This file is dual licensed under the MIT and the University of Illinois Open 6229109Sed * Source Licenses. See LICENSE.TXT for details. 7229109Sed * 8229109Sed * ===----------------------------------------------------------------------=== 9229109Sed * 10229109Sed * This file is not part of the interface of this library. 11229109Sed * 12229109Sed * This file defines various standard types, most importantly a number of unions 13229109Sed * used to access parts of larger types. 14229109Sed * 15229109Sed * ===----------------------------------------------------------------------=== 16229109Sed */ 17229109Sed 18229109Sed#ifndef INT_TYPES_H 19229109Sed#define INT_TYPES_H 20229109Sed 21229109Sed#include "int_endianness.h" 22229109Sed 23229109Sedtypedef int si_int; 24229109Sedtypedef unsigned su_int; 25229109Sed 26229109Sedtypedef long long di_int; 27229109Sedtypedef unsigned long long du_int; 28229109Sed 29229109Sedtypedef union 30229109Sed{ 31229109Sed di_int all; 32229109Sed struct 33229109Sed { 34229109Sed#if _YUGA_LITTLE_ENDIAN 35229109Sed su_int low; 36229109Sed si_int high; 37229109Sed#else 38229109Sed si_int high; 39229109Sed su_int low; 40229109Sed#endif /* _YUGA_LITTLE_ENDIAN */ 41229109Sed }s; 42229109Sed} dwords; 43229109Sed 44229109Sedtypedef union 45229109Sed{ 46229109Sed du_int all; 47229109Sed struct 48229109Sed { 49229109Sed#if _YUGA_LITTLE_ENDIAN 50229109Sed su_int low; 51229109Sed su_int high; 52229109Sed#else 53229109Sed su_int high; 54229109Sed su_int low; 55229109Sed#endif /* _YUGA_LITTLE_ENDIAN */ 56229109Sed }s; 57229109Sed} udwords; 58229109Sed 59263764Sdim#if __LP64__ 60263764Sdim#define CRT_HAS_128BIT 61263764Sdim#endif 62229109Sed 63263764Sdim#ifdef CRT_HAS_128BIT 64229109Sedtypedef int ti_int __attribute__ ((mode (TI))); 65229109Sedtypedef unsigned tu_int __attribute__ ((mode (TI))); 66229109Sed 67229109Sedtypedef union 68229109Sed{ 69229109Sed ti_int all; 70229109Sed struct 71229109Sed { 72229109Sed#if _YUGA_LITTLE_ENDIAN 73229109Sed du_int low; 74229109Sed di_int high; 75229109Sed#else 76229109Sed di_int high; 77229109Sed du_int low; 78229109Sed#endif /* _YUGA_LITTLE_ENDIAN */ 79229109Sed }s; 80229109Sed} twords; 81229109Sed 82229109Sedtypedef union 83229109Sed{ 84229109Sed tu_int all; 85229109Sed struct 86229109Sed { 87229109Sed#if _YUGA_LITTLE_ENDIAN 88229109Sed du_int low; 89229109Sed du_int high; 90229109Sed#else 91229109Sed du_int high; 92229109Sed du_int low; 93229109Sed#endif /* _YUGA_LITTLE_ENDIAN */ 94229109Sed }s; 95229109Sed} utwords; 96229109Sed 97229109Sedstatic inline ti_int make_ti(di_int h, di_int l) { 98229109Sed twords r; 99229109Sed r.s.high = h; 100229109Sed r.s.low = l; 101229109Sed return r.all; 102229109Sed} 103229109Sed 104229109Sedstatic inline tu_int make_tu(du_int h, du_int l) { 105229109Sed utwords r; 106229109Sed r.s.high = h; 107229109Sed r.s.low = l; 108229109Sed return r.all; 109229109Sed} 110229109Sed 111263764Sdim#endif /* CRT_HAS_128BIT */ 112229109Sed 113229109Sedtypedef union 114229109Sed{ 115229109Sed su_int u; 116229109Sed float f; 117229109Sed} float_bits; 118229109Sed 119229109Sedtypedef union 120229109Sed{ 121229109Sed udwords u; 122229109Sed double f; 123229109Sed} double_bits; 124229109Sed 125229109Sedtypedef struct 126229109Sed{ 127229109Sed#if _YUGA_LITTLE_ENDIAN 128229109Sed udwords low; 129229109Sed udwords high; 130229109Sed#else 131229109Sed udwords high; 132229109Sed udwords low; 133229109Sed#endif /* _YUGA_LITTLE_ENDIAN */ 134229109Sed} uqwords; 135229109Sed 136229109Sedtypedef union 137229109Sed{ 138229109Sed uqwords u; 139229109Sed long double f; 140229109Sed} long_double_bits; 141229109Sed 142229109Sed#endif /* INT_TYPES_H */ 143229109Sed 144