SCM Repository
Annotation of /branches/pure-cfg/src/include/Diderot/types.h
Parent Directory
|
Revision Log
Revision 1594 - (view) (download) (as text)
1 : | jhr | 710 | /*! \file types.h |
2 : | * | ||
3 : | * \author John Reppy | ||
4 : | */ | ||
5 : | |||
6 : | /* | ||
7 : | * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu) | ||
8 : | * All rights reserved. | ||
9 : | */ | ||
10 : | |||
11 : | #ifndef _DIDEROT_TYPES_H_ | ||
12 : | #define _DIDEROT_TYPES_H_ | ||
13 : | |||
14 : | /* library-call status */ | ||
15 : | typedef enum { DIDEROT_OK = 0, DIDEROT_FAIL = -1 } Status_t; | ||
16 : | |||
17 : | jhr | 1130 | /*! \brief The strand status type is used to both track the current status |
18 : | * of a strand in the runtime system and as the return type for the update | ||
19 : | * method. | ||
20 : | */ | ||
21 : | typedef enum { | ||
22 : | DIDEROT_ACTIVE = 0, //!< a currently running strand | ||
23 : | DIDEROT_NEW = 1, //!< a newly created, but not yet active, strand | ||
24 : | DIDEROT_DIE, //!< a dead strand | ||
25 : | DIDEROT_STABILIZE, //!< a strand that will be stable at the end of | ||
26 : | //!< the current step | ||
27 : | DIDEROT_STABLE //!< a stable strand | ||
28 : | } StrandStatus_t; | ||
29 : | jhr | 710 | |
30 : | /* SSE vector types */ | ||
31 : | typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); | ||
32 : | #ifdef VEC2_OK | ||
33 : | typedef float vec2f_t __attribute__ ((vector_size (8))); | ||
34 : | #else | ||
35 : | typedef float vec2f_t __attribute__ ((vector_size (16))); // pad so that gcc aligns correctly | ||
36 : | #endif | ||
37 : | typedef float vec4f_t __attribute__ ((vector_size (16))); | ||
38 : | typedef float vec8f_t __attribute__ ((vector_size (32))); | ||
39 : | |||
40 : | #ifdef VEC2_OK | ||
41 : | typedef int32_t vec2i_t __attribute__ ((vector_size (8))); | ||
42 : | #else | ||
43 : | typedef int32_t vec2i_t __attribute__ ((vector_size (16))); // pad so that gcc aligns correctly | ||
44 : | #endif | ||
45 : | typedef int32_t vec4i_t __attribute__ ((vector_size (16))); | ||
46 : | typedef int32_t vec8i_t __attribute__ ((vector_size (32))); | ||
47 : | |||
48 : | jhr | 1594 | typedef double vec2d_t __attribute__ ((vector_size (16))); |
49 : | typedef double vec4d_t __attribute__ ((vector_size (32))); | ||
50 : | typedef double vec8d_t __attribute__ ((vector_size (64))); | ||
51 : | jhr | 710 | |
52 : | typedef int64_t vec2l_t __attribute__ ((vector_size (16))); | ||
53 : | typedef int64_t vec4l_t __attribute__ ((vector_size (32))); | ||
54 : | typedef int64_t vec8l_t __attribute__ ((vector_size (64))); | ||
55 : | |||
56 : | typedef union { float r[2]; vec2f_t v; } union2f_t; | ||
57 : | typedef union { float r[4]; vec4f_t v; } union4f_t; | ||
58 : | typedef union { float r[8]; vec8f_t v; } union8f_t; | ||
59 : | |||
60 : | typedef union { int32_t i[2]; vec2i_t v; } union2i_t; | ||
61 : | typedef union { int32_t i[4]; vec4i_t v; } union4i_t; | ||
62 : | typedef union { int32_t i[8]; vec8i_t v; } union8i_t; | ||
63 : | |||
64 : | typedef union { double r[2]; vec2d_t v; } union2d_t; | ||
65 : | typedef union { double r[4]; vec4d_t v; } union4d_t; | ||
66 : | typedef union { double r[8]; vec8d_t v; } union8d_t; | ||
67 : | |||
68 : | typedef union { int64_t r[2]; vec2l_t v; } union2l_t; | ||
69 : | typedef union { int64_t r[4]; vec4l_t v; } union4l_t; | ||
70 : | typedef union { int64_t r[8]; vec8l_t v; } union8l_t; | ||
71 : | |||
72 : | /* vector lengths must be power of 2, but vec3 is useful, so we pad to 4 */ | ||
73 : | typedef vec4f_t vec3f_t; | ||
74 : | typedef union4f_t union3f_t; | ||
75 : | typedef vec4d_t vec3d_t; | ||
76 : | typedef union4d_t union3d_t; | ||
77 : | typedef vec4i_t vec3i_t; | ||
78 : | typedef union4i_t union3i_t; | ||
79 : | typedef vec4l_t vec3l_t; | ||
80 : | typedef union4l_t union3l_t; | ||
81 : | |||
82 : | /* typedefs for Diderot types */ | ||
83 : | #if defined(DIDEROT_SINGLE_PRECISION) | ||
84 : | typedef float Diderot_real_t; | ||
85 : | jhr | 1213 | typedef vec2f_t Diderot_vec2_t; |
86 : | typedef vec3f_t Diderot_vec3_t; | ||
87 : | typedef vec4f_t Diderot_vec4_t; | ||
88 : | typedef union2f_t Diderot_union2_t; | ||
89 : | typedef union3f_t Diderot_union3_t; | ||
90 : | typedef union4f_t Diderot_union4_t; | ||
91 : | typedef union2f_t Diderot_Mat2x2_t[2]; // represented as row vectors | ||
92 : | typedef union3f_t Diderot_Mat3x3_t[3]; // represented as row vectors | ||
93 : | typedef union4f_t Diderot_Mat4x4_t[4]; // represented as row vectors | ||
94 : | jhr | 1593 | #elif defined(DIDEROT_DOUBLE_PRECISION) |
95 : | jhr | 710 | typedef double Diderot_real_t; |
96 : | jhr | 1213 | typedef vec2d_t Diderot_vec2_t; |
97 : | typedef vec3d_t Diderot_vec3_t; | ||
98 : | typedef vec4d_t Diderot_vec4_t; | ||
99 : | typedef union2d_t Diderot_union2_t; | ||
100 : | typedef union3d_t Diderot_union3_t; | ||
101 : | typedef union4d_t Diderot_union4_t; | ||
102 : | typedef union2d_t Diderot_Mat2x2_t[2]; // represented as row vectors | ||
103 : | typedef union3d_t Diderot_Mat3x3_t[3]; // represented as row vectors | ||
104 : | typedef union4d_t Diderot_Mat4x4_t[4]; // represented as row vectors | ||
105 : | jhr | 1593 | #else |
106 : | # error floating-point precision unknown | ||
107 : | jhr | 710 | #endif |
108 : | jhr | 1593 | #if defined(DIDEROT_INT) |
109 : | typedef int32_t Diderot_int_t; | ||
110 : | typedef vec2i_t Diderot_ivec2_t; | ||
111 : | typedef vec3i_t Diderot_ivec3_t; | ||
112 : | typedef vec4i_t Diderot_ivec4_t; | ||
113 : | typedef union2i_t Diderot_iunion2_t; | ||
114 : | typedef union3i_t Diderot_iunion3_t; | ||
115 : | typedef union4i_t Diderot_iunion4_t; | ||
116 : | #elif defined(DIDEROT_LONGINT) | ||
117 : | typedef int64_t Diderot_int_t; | ||
118 : | typedef vec2l_t Diderot_ivec2_t; | ||
119 : | typedef vec3l_t Diderot_ivec3_t; | ||
120 : | typedef vec4l_t Diderot_ivec4_t; | ||
121 : | typedef union2l_t Diderot_iunion2_t; | ||
122 : | typedef union3l_t Diderot_iunion3_t; | ||
123 : | typedef union4l_t Diderot_iunion4_t; | ||
124 : | #else | ||
125 : | # error integer precision unknown | ||
126 : | #endif | ||
127 : | jhr | 710 | typedef const char *Diderot_string_t; |
128 : | |||
129 : | jhr | 1213 | typedef struct { // wrapper for 1D image data |
130 : | jhr | 1354 | uint32_t dim; //!< dimension (== 1) |
131 : | jhr | 1213 | uint32_t size[1]; |
132 : | jhr | 1354 | size_t dataSzb; //!< size of data in bytes |
133 : | jhr | 1213 | void *data; |
134 : | jhr | 1354 | Diderot_real_t s; //!< scaling from world-space to image-space |
135 : | Diderot_real_t t; //!< translation from world-space to image-space | ||
136 : | jhr | 710 | } Diderot_image1D_t; |
137 : | |||
138 : | jhr | 1213 | typedef struct { // wrapper for 2D image data |
139 : | jhr | 1354 | uint32_t dim; //!< dimension (== 2) |
140 : | uint32_t size[2]; //!< sizes (fast to slow) | ||
141 : | size_t dataSzb; //!< size of data in bytes | ||
142 : | jhr | 1213 | void *data; |
143 : | jhr | 1354 | Diderot_Mat2x2_t w2i; //!< affine tranform from world space to index space. This is the |
144 : | //! inverse of the index to world-space transform that is loaded from | ||
145 : | //! the Nrrd file. | ||
146 : | Diderot_vec2_t tVec; //!< translation part of world to index transform | ||
147 : | Diderot_Mat2x2_t w2iT; //!< transpose w3i | ||
148 : | jhr | 710 | } Diderot_image2D_t; |
149 : | |||
150 : | jhr | 1213 | typedef struct { // wrapper for 3D image data |
151 : | jhr | 1448 | uint32_t dim; //!< dimension (== 3) |
152 : | uint32_t size[3]; //!< sizes (fast to slow) | ||
153 : | jhr | 1354 | size_t dataSzb; //!< size of data in bytes |
154 : | jhr | 1213 | void *data; |
155 : | jhr | 1354 | Diderot_Mat3x3_t w2i; //!< affine tranform from world space to index space. This is the |
156 : | //! inverse of the index to world-space transform that is loaded from | ||
157 : | //! the Nrrd file. | ||
158 : | Diderot_vec3_t tVec; //!< translation part of world to index transform | ||
159 : | Diderot_Mat3x3_t w2iT; //!< transpose w3i | ||
160 : | jhr | 710 | } Diderot_image3D_t; |
161 : | |||
162 : | #endif /* !_DIDEROT_TYPES_H_ */ |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |