Home | History | Annotate | Download | only in Arm
      1 /**
      2 University of Illinois/NCSA
      3 Open Source License
      4 
      5 Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
      6 
      7 All rights reserved.
      8 
      9 Developed by:
     10 
     11     LLVM Team
     12 
     13     University of Illinois at Urbana-Champaign
     14 
     15     http://llvm.org
     16 
     17 Permission is hereby granted, free of charge, to any person obtaining a copy of
     18 this software and associated documentation files (the "Software"), to deal with
     19 the Software without restriction, including without limitation the rights to
     20 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
     21 of the Software, and to permit persons to whom the Software is furnished to do
     22 so, subject to the following conditions:
     23 
     24     * Redistributions of source code must retain the above copyright notice,
     25       this list of conditions and the following disclaimers.
     26 
     27     * Redistributions in binary form must reproduce the above copyright notice,
     28       this list of conditions and the following disclaimers in the
     29       documentation and/or other materials provided with the distribution.
     30 
     31     * Neither the names of the LLVM Team, University of Illinois at
     32       Urbana-Champaign, nor the names of its contributors may be used to
     33       endorse or promote products derived from this Software without specific
     34       prior written permission.
     35 
     36 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     37 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
     38 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     39 CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     40 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     41 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
     42 SOFTWARE.
     43 **/
     44 
     45 #ifndef INT_TYPES_H
     46 #define INT_TYPES_H
     47 
     48 #include "int_endianness.h"
     49 
     50 typedef      int si_int;
     51 typedef unsigned su_int;
     52 
     53 typedef          long long di_int;
     54 typedef unsigned long long du_int;
     55 
     56 typedef union
     57 {
     58     di_int all;
     59     struct
     60     {
     61 #if _YUGA_LITTLE_ENDIAN
     62         su_int low;
     63         si_int high;
     64 #else
     65         si_int high;
     66         su_int low;
     67 #endif /* _YUGA_LITTLE_ENDIAN */
     68     }s;
     69 } dwords;
     70 
     71 typedef union
     72 {
     73     du_int all;
     74     struct
     75     {
     76 #if _YUGA_LITTLE_ENDIAN
     77         su_int low;
     78         su_int high;
     79 #else
     80         su_int high;
     81         su_int low;
     82 #endif /* _YUGA_LITTLE_ENDIAN */
     83     }s;
     84 } udwords;
     85 
     86 #if __LP64__
     87 #define CRT_HAS_128BIT
     88 #endif
     89 
     90 #ifdef CRT_HAS_128BIT
     91 typedef int      ti_int __attribute__ ((mode (TI)));
     92 typedef unsigned tu_int __attribute__ ((mode (TI)));
     93 
     94 typedef union
     95 {
     96     ti_int all;
     97     struct
     98     {
     99 #if _YUGA_LITTLE_ENDIAN
    100         du_int low;
    101         di_int high;
    102 #else
    103         di_int high;
    104         du_int low;
    105 #endif /* _YUGA_LITTLE_ENDIAN */
    106     }s;
    107 } twords;
    108 
    109 typedef union
    110 {
    111     tu_int all;
    112     struct
    113     {
    114 #if _YUGA_LITTLE_ENDIAN
    115         du_int low;
    116         du_int high;
    117 #else
    118         du_int high;
    119         du_int low;
    120 #endif /* _YUGA_LITTLE_ENDIAN */
    121     }s;
    122 } utwords;
    123 
    124 static inline ti_int make_ti(di_int h, di_int l) {
    125     twords r;
    126     r.s.high = h;
    127     r.s.low = l;
    128     return r.all;
    129 }
    130 
    131 static inline tu_int make_tu(du_int h, du_int l) {
    132     utwords r;
    133     r.s.high = h;
    134     r.s.low = l;
    135     return r.all;
    136 }
    137 
    138 #endif /* CRT_HAS_128BIT */
    139 
    140 typedef union
    141 {
    142     su_int u;
    143     float f;
    144 } float_bits;
    145 
    146 typedef union
    147 {
    148     udwords u;
    149     double  f;
    150 } double_bits;
    151 
    152 typedef struct
    153 {
    154 #if _YUGA_LITTLE_ENDIAN
    155     udwords low;
    156     udwords high;
    157 #else
    158     udwords high;
    159     udwords low;
    160 #endif /* _YUGA_LITTLE_ENDIAN */
    161 } uqwords;
    162 
    163 typedef union
    164 {
    165     uqwords     u;
    166     long double f;
    167 } long_double_bits;
    168 
    169 #endif /* INT_TYPES_H */
    170 
    171