xref: /illumos-gate/usr/src/common/ficl/ficlplatform/unix.h (revision dfaefdd8665cacf1287fb85bfbcc7599c9f7f1f9)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2015 Toomas Soome <tsoome@me.com>
14  */
15 
16 #ifndef _UNIX_H
17 #define	_UNIX_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define	FICL_WANT_PLATFORM (1)
24 
25 #define	FICL_PLATFORM_OS		"illumos"
26 #if defined(__i386__) || defined(__amd64__)
27 #define	FICL_PLATFORM_ARCHITECTURE	"i386"
28 #elif defined(__aarch64__)
29 #define	FICL_PLATFORM_ARCHITECTURE	"aarch64"
30 #else
31 #error "unsupported plarform"
32 #endif
33 
34 #define	FICL_PLATFORM_BASIC_TYPES	(1)
35 #if defined(_LP64)
36 #define	FICL_PLATFORM_ALIGNMENT		(8)
37 #else
38 #define	FICL_PLATFORM_ALIGNMENT		(4)
39 #endif
40 #define	FICL_PLATFORM_INLINE		inline
41 
42 #define	FICL_PLATFORM_HAS_FTRUNCATE	(1)
43 #if defined(_LP64)
44 #define	FICL_PLATFORM_HAS_2INTEGER	(0)
45 #else
46 #define	FICL_PLATFORM_HAS_2INTEGER	(1)
47 #endif
48 
49 typedef int8_t ficlInteger8;
50 typedef uint8_t ficlUnsigned8;
51 typedef int16_t ficlInteger16;
52 typedef uint16_t ficlUnsigned16;
53 typedef int32_t ficlInteger32;
54 typedef uint32_t ficlUnsigned32;
55 typedef int64_t ficlInteger64;
56 typedef uint64_t ficlUnsigned64;
57 
58 #if defined(_LP64)
59 typedef ficlInteger64 ficlInteger;
60 typedef ficlUnsigned64 ficlUnsigned;
61 
62 typedef double ficlFloat;
63 #else /* default */
64 typedef ficlInteger32 ficlInteger;
65 typedef ficlUnsigned32 ficlUnsigned;
66 
67 typedef float ficlFloat;
68 #endif
69 
70 #if defined(FICL_PLATFORM_HAS_2INTEGER) && FICL_PLATFORM_HAS_2INTEGER
71 typedef ficlInteger64 ficl2Integer;
72 typedef ficlUnsigned64 ficl2Unsigned;
73 #endif
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif /* _UNIX_H */
80