Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /trunk/src/include/Diderot/types.h
ViewVC logotype

Annotation of /trunk/src/include/Diderot/types.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3349 - (view) (download) (as text)

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

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0