xref: /openbsd-src/sys/lib/libkern/crt_glue.h (revision 49f00df61520a457c70db7bca65b2d6bc6acdd2a)
1*49f00df6Sjca /* ===-- int_lib.h - configuration header for compiler-rt  -----------------===
2*49f00df6Sjca  *
3*49f00df6Sjca  *                     The LLVM Compiler Infrastructure
4*49f00df6Sjca  *
5*49f00df6Sjca  * This file is dual licensed under the MIT and the University of Illinois Open
6*49f00df6Sjca  * Source Licenses. See LICENSE.TXT for details.
7*49f00df6Sjca  *
8*49f00df6Sjca  * ===----------------------------------------------------------------------===
9*49f00df6Sjca  *
10*49f00df6Sjca  * This file is a compat header for compiler-rt source files used in the OpenBSD
11*49f00df6Sjca  * kernel.
12*49f00df6Sjca  * This file is not part of the interface of this library.
13*49f00df6Sjca  *
14*49f00df6Sjca  * ===----------------------------------------------------------------------===
15*49f00df6Sjca  */
16*49f00df6Sjca 
17*49f00df6Sjca #ifndef _CRT_INT_LIB_H_
18*49f00df6Sjca #define  _CRT_INT_LIB_H_
19*49f00df6Sjca 
20*49f00df6Sjca #include <sys/limits.h>
21*49f00df6Sjca #include <sys/endian.h>
22*49f00df6Sjca 
23*49f00df6Sjca typedef int      si_int;
24*49f00df6Sjca typedef unsigned int su_int;
25*49f00df6Sjca typedef          long long di_int;
26*49f00df6Sjca typedef unsigned long long du_int;
27*49f00df6Sjca typedef int      ti_int __attribute__ ((mode (TI)));
28*49f00df6Sjca typedef int      tu_int __attribute__ ((mode (TI)));
29*49f00df6Sjca 
30*49f00df6Sjca #if BYTE_ORDER == LITTLE_ENDIAN
31*49f00df6Sjca #define _YUGA_LITTLE_ENDIAN 0
32*49f00df6Sjca #else
33*49f00df6Sjca #define _YUGA_LITTLE_ENDIAN 1
34*49f00df6Sjca #endif
35*49f00df6Sjca 
36*49f00df6Sjca typedef union
37*49f00df6Sjca {
38*49f00df6Sjca     ti_int all;
39*49f00df6Sjca     struct
40*49f00df6Sjca     {
41*49f00df6Sjca #if _YUGA_LITTLE_ENDIAN
42*49f00df6Sjca         du_int low;
43*49f00df6Sjca         di_int high;
44*49f00df6Sjca #else
45*49f00df6Sjca         di_int high;
46*49f00df6Sjca         du_int low;
47*49f00df6Sjca #endif /* _YUGA_LITTLE_ENDIAN */
48*49f00df6Sjca     }s;
49*49f00df6Sjca } twords;
50*49f00df6Sjca 
51*49f00df6Sjca typedef union
52*49f00df6Sjca {
53*49f00df6Sjca 	tu_int all;
54*49f00df6Sjca 	struct
55*49f00df6Sjca 	{
56*49f00df6Sjca #if _YUGA_LITTLE_ENDIAN
57*49f00df6Sjca 		du_int low;
58*49f00df6Sjca 		du_int high;
59*49f00df6Sjca #else
60*49f00df6Sjca 		du_int high;
61*49f00df6Sjca 		du_int low;
62*49f00df6Sjca #endif /* _YUGA_LITTLE_ENDIAN */
63*49f00df6Sjca 	}s;
64*49f00df6Sjca } utwords;
65*49f00df6Sjca 
66*49f00df6Sjca #endif /* _CRT_INT_LIB_H_ */
67