1 | /* ---------------- */ |
---|
2 | /* --- nrtype.h --- */ |
---|
3 | /* ---------------- */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
7 | * Univ Paris Sud XI, CNRS |
---|
8 | * |
---|
9 | * Modif : 15/01/2001 : rgb16, rgb32 are now signed (int16, int32) |
---|
10 | * modif : 22/02/2001 : new types : float32 & float64 |
---|
11 | * modif : 15/02/2004 : clean-up previous definition for mac-OSX port |
---|
12 | * modif: 1/06/2010 : split of def.h into nrtype.h nrdefine.h ... |
---|
13 | */ |
---|
14 | |
---|
15 | #ifndef _NRTYPE_H_ |
---|
16 | #define _NRTYPE_H_ |
---|
17 | |
---|
18 | #ifdef __cplusplus |
---|
19 | #pragma message ("C++") |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | #define VERBOSE_PRAGMA |
---|
24 | |
---|
25 | #ifdef VERBOSE_PRAGMA |
---|
26 | //#pragma message ("- include nrtype.h") |
---|
27 | #endif |
---|
28 | |
---|
29 | // ---------------------------------- // |
---|
30 | // -- don not write under the line -- // |
---|
31 | // ---------------------------------- // |
---|
32 | |
---|
33 | #include "mypredef.h" |
---|
34 | |
---|
35 | typedef unsigned char BOOLEAN; |
---|
36 | typedef unsigned char boolean; |
---|
37 | typedef int BOOL; |
---|
38 | #ifdef VERBOSE_PRAGMA |
---|
39 | //#pragma message("boolean") |
---|
40 | #endif |
---|
41 | |
---|
42 | #ifndef TRUE |
---|
43 | #define TRUE 1 |
---|
44 | #else |
---|
45 | #pragma message(" ATTENTION : TRUE already defined") |
---|
46 | #endif |
---|
47 | |
---|
48 | #ifndef FALSE |
---|
49 | #define FALSE 0 |
---|
50 | #else |
---|
51 | #pragma message(" ATTENTION : FALSE already defined") |
---|
52 | #endif |
---|
53 | |
---|
54 | /* ------------------------------- */ |
---|
55 | /* --- 8, 16, 32, 64 bit types --- */ |
---|
56 | /* ------------------------------- */ |
---|
57 | // old types to be removed |
---|
58 | //typedef sint16 usint16 ; |
---|
59 | //typedef int uint; |
---|
60 | |
---|
61 | // half-typed types |
---|
62 | |
---|
63 | typedef char byte; |
---|
64 | //typedef char usint16 ; |
---|
65 | //typedef char uint; |
---|
66 | |
---|
67 | typedef char int8; |
---|
68 | typedef short int16; |
---|
69 | typedef int int32; |
---|
70 | typedef long long int64; |
---|
71 | |
---|
72 | #ifdef LIBCOMP |
---|
73 | #if defined(myCompiler_ICC) || defined (myCompiler_MSC) |
---|
74 | typedef __int64 int64; |
---|
75 | #else |
---|
76 | typedef long long int64; |
---|
77 | #endif |
---|
78 | #endif |
---|
79 | |
---|
80 | // full-typed types |
---|
81 | typedef signed char sint8; |
---|
82 | typedef unsigned char uint8; |
---|
83 | |
---|
84 | typedef signed short sint16; |
---|
85 | typedef unsigned short uint16; |
---|
86 | |
---|
87 | typedef signed int sint32; |
---|
88 | typedef unsigned int uint32; |
---|
89 | |
---|
90 | #if defined(myCompiler_ICC) || defined (myCompiler_MSC) |
---|
91 | typedef __int64 int64; |
---|
92 | typedef signed __int64 sint64; |
---|
93 | typedef unsigned __int64 uint64; |
---|
94 | #else |
---|
95 | typedef signed long long sint64; |
---|
96 | typedef unsigned long long uint64; |
---|
97 | #endif |
---|
98 | |
---|
99 | typedef float float32; |
---|
100 | typedef double float64; |
---|
101 | |
---|
102 | /* -------------------- */ |
---|
103 | /* --- complex type --- */ |
---|
104 | /* -------------------- */ |
---|
105 | typedef struct { float32 x; float32 y;} complex32; |
---|
106 | typedef struct { float64 x; float64 y;} complex64; |
---|
107 | |
---|
108 | /* --------------------- */ |
---|
109 | /* --- RGB, BGR type --- */ |
---|
110 | /* --------------------- */ |
---|
111 | //typedef struct { byte r; byte g; byte b; } rgb8; |
---|
112 | |
---|
113 | typedef struct { uint8 r; uint8 g; uint8 b; } rgb8; |
---|
114 | typedef struct { sint16 r; sint16 g; sint16 b; } rgb16; |
---|
115 | typedef struct { sint32 r; sint32 g; sint32 b; } rgb32; |
---|
116 | typedef struct { float32 r; float32 g; float32 b; } rgbf32; |
---|
117 | |
---|
118 | typedef struct { uint8 b; uint8 g; uint8 r; } bgr8; |
---|
119 | typedef struct { sint16 b; sint16 g; sint16 r; } bgr16; |
---|
120 | typedef struct { sint32 b; sint32 g; sint32 r; } bgr32; |
---|
121 | typedef struct { float32 b; float32 g; float32 r; } bgrf32; |
---|
122 | |
---|
123 | typedef struct { uint8 r; uint8 g; uint8 b; uint8 x; } rgbx8; |
---|
124 | typedef struct { int16 r; int16 g; int16 b; int16 x; } rgbx16; |
---|
125 | typedef struct { int32 r; int32 g; int32 b; int32 x; } rgbx32; |
---|
126 | typedef struct { float32 r; float32 g; float32 b; float32 x; } rgbxf32; |
---|
127 | |
---|
128 | typedef struct { uint8 x; uint8 b; uint8 g; uint8 r; } bgrx8; |
---|
129 | typedef struct { int16 x; int16 b; int16 g; int16 r; } bgrx16; |
---|
130 | typedef struct { int32 x; int32 b; int32 g; int32 r; } bgrx32; |
---|
131 | typedef struct { float32 x; float32 b; float32 g; float32 r; } bgrxf32; |
---|
132 | |
---|
133 | /* ---------------- */ |
---|
134 | /* --- bitfield --- */ |
---|
135 | /* ---------------- */ |
---|
136 | typedef struct { |
---|
137 | unsigned int b0 : 1; |
---|
138 | unsigned int b1 : 1; |
---|
139 | unsigned int b2 : 1; |
---|
140 | unsigned int b3 : 1; |
---|
141 | unsigned int b4 : 1; |
---|
142 | unsigned int b5 : 1; |
---|
143 | unsigned int b6 : 1; |
---|
144 | unsigned int b7 : 1; |
---|
145 | unsigned int b8 : 1; |
---|
146 | unsigned int b9 : 1; |
---|
147 | unsigned int b10 : 1; |
---|
148 | unsigned int b11 : 1; |
---|
149 | unsigned int b12 : 1; |
---|
150 | unsigned int b13 : 1; |
---|
151 | unsigned int b14 : 1; |
---|
152 | unsigned int b15 : 1; |
---|
153 | unsigned int b16 : 1; |
---|
154 | unsigned int b17 : 1; |
---|
155 | unsigned int b18 : 1; |
---|
156 | unsigned int b19 : 1; |
---|
157 | unsigned int b20 : 1; |
---|
158 | unsigned int b21 : 1; |
---|
159 | unsigned int b22 : 1; |
---|
160 | unsigned int b23 : 1; |
---|
161 | unsigned int b24 : 1; |
---|
162 | unsigned int b25 : 1; |
---|
163 | unsigned int b26 : 1; |
---|
164 | unsigned int b27 : 1; |
---|
165 | unsigned int b28 : 1; |
---|
166 | unsigned int b29 : 1; |
---|
167 | unsigned int b30 : 1; |
---|
168 | unsigned int b31 : 1; |
---|
169 | } bitfield32; |
---|
170 | |
---|
171 | typedef struct { |
---|
172 | unsigned int b0 : 1; |
---|
173 | unsigned int b1 : 1; |
---|
174 | unsigned int b2 : 1; |
---|
175 | unsigned int b3 : 1; |
---|
176 | unsigned int b4 : 1; |
---|
177 | unsigned int b5 : 1; |
---|
178 | unsigned int b6 : 1; |
---|
179 | unsigned int b7 : 1; |
---|
180 | unsigned int b8 : 1; |
---|
181 | unsigned int b9 : 1; |
---|
182 | unsigned int b10 : 1; |
---|
183 | unsigned int b11 : 1; |
---|
184 | unsigned int b12 : 1; |
---|
185 | unsigned int b13 : 1; |
---|
186 | unsigned int b14 : 1; |
---|
187 | unsigned int b15 : 1; |
---|
188 | } bitfield16; |
---|
189 | |
---|
190 | typedef struct { |
---|
191 | unsigned int b0 : 1; |
---|
192 | unsigned int b1 : 1; |
---|
193 | unsigned int b2 : 1; |
---|
194 | unsigned int b3 : 1; |
---|
195 | unsigned int b4 : 1; |
---|
196 | unsigned int b5 : 1; |
---|
197 | unsigned int b6 : 1; |
---|
198 | unsigned int b7 : 1; |
---|
199 | } bitfield8; |
---|
200 | |
---|
201 | #ifdef __cplusplus |
---|
202 | } |
---|
203 | #endif |
---|
204 | |
---|
205 | #endif // _NR_TYPE_H_ |
---|