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

SCM Repository

[diderot] Annotation of /branches/pure-cfg/src/include/Diderot/types.h
ViewVC logotype

Annotation of /branches/pure-cfg/src/include/Diderot/types.h

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : jhr 710 /*! \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 710 * 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 1130 /*! \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 710
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 1594 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 710
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 :     /* vector lengths must be power of 2, but vec3 is useful, so we pad to 4 */
75 :     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 :    
84 :     /* typedefs for Diderot types */
85 :     #if defined(DIDEROT_SINGLE_PRECISION)
86 :     typedef float Diderot_real_t;
87 : jhr 1213 typedef vec2f_t Diderot_vec2_t;
88 :     typedef vec3f_t Diderot_vec3_t;
89 :     typedef vec4f_t Diderot_vec4_t;
90 :     typedef union2f_t Diderot_union2_t;
91 :     typedef union3f_t Diderot_union3_t;
92 :     typedef union4f_t Diderot_union4_t;
93 :     typedef union2f_t Diderot_Mat2x2_t[2]; // represented as row vectors
94 :     typedef union3f_t Diderot_Mat3x3_t[3]; // represented as row vectors
95 :     typedef union4f_t Diderot_Mat4x4_t[4]; // represented as row vectors
96 : jhr 1593 #elif defined(DIDEROT_DOUBLE_PRECISION)
97 : jhr 710 typedef double Diderot_real_t;
98 : jhr 1213 typedef vec2d_t Diderot_vec2_t;
99 :     typedef vec3d_t Diderot_vec3_t;
100 :     typedef vec4d_t Diderot_vec4_t;
101 :     typedef union2d_t Diderot_union2_t;
102 :     typedef union3d_t Diderot_union3_t;
103 :     typedef union4d_t Diderot_union4_t;
104 :     typedef union2d_t Diderot_Mat2x2_t[2]; // represented as row vectors
105 :     typedef union3d_t Diderot_Mat3x3_t[3]; // represented as row vectors
106 :     typedef union4d_t Diderot_Mat4x4_t[4]; // represented as row vectors
107 : jhr 1593 #else
108 :     # error floating-point precision unknown
109 : jhr 710 #endif
110 : jhr 1593 #if defined(DIDEROT_INT)
111 :     typedef int32_t Diderot_int_t;
112 :     typedef vec2i_t Diderot_ivec2_t;
113 :     typedef vec3i_t Diderot_ivec3_t;
114 :     typedef vec4i_t Diderot_ivec4_t;
115 :     typedef union2i_t Diderot_iunion2_t;
116 :     typedef union3i_t Diderot_iunion3_t;
117 :     typedef union4i_t Diderot_iunion4_t;
118 :     #elif defined(DIDEROT_LONGINT)
119 :     typedef int64_t Diderot_int_t;
120 :     typedef vec2l_t Diderot_ivec2_t;
121 :     typedef vec3l_t Diderot_ivec3_t;
122 :     typedef vec4l_t Diderot_ivec4_t;
123 :     typedef union2l_t Diderot_iunion2_t;
124 :     typedef union3l_t Diderot_iunion3_t;
125 :     typedef union4l_t Diderot_iunion4_t;
126 :     #else
127 :     # error integer precision unknown
128 :     #endif
129 : jhr 710 typedef const char *Diderot_string_t;
130 :    
131 : jhr 1213 typedef struct { // wrapper for 1D image data
132 : jhr 1354 uint32_t dim; //!< dimension (== 1)
133 : jhr 1213 uint32_t size[1];
134 : jhr 1354 size_t dataSzb; //!< size of data in bytes
135 : jhr 1213 void *data;
136 : jhr 1354 Diderot_real_t s; //!< scaling from world-space to image-space
137 :     Diderot_real_t t; //!< translation from world-space to image-space
138 : jhr 710 } Diderot_image1D_t;
139 :    
140 : jhr 1213 typedef struct { // wrapper for 2D image data
141 : jhr 1354 uint32_t dim; //!< dimension (== 2)
142 :     uint32_t size[2]; //!< sizes (fast to slow)
143 :     size_t dataSzb; //!< size of data in bytes
144 : jhr 1213 void *data;
145 : jhr 1354 Diderot_Mat2x2_t w2i; //!< affine tranform from world space to index space. This is the
146 :     //! inverse of the index to world-space transform that is loaded from
147 :     //! the Nrrd file.
148 :     Diderot_vec2_t tVec; //!< translation part of world to index transform
149 :     Diderot_Mat2x2_t w2iT; //!< transpose w3i
150 : jhr 710 } Diderot_image2D_t;
151 :    
152 : jhr 1213 typedef struct { // wrapper for 3D image data
153 : jhr 1448 uint32_t dim; //!< dimension (== 3)
154 :     uint32_t size[3]; //!< sizes (fast to slow)
155 : jhr 1354 size_t dataSzb; //!< size of data in bytes
156 : jhr 1213 void *data;
157 : jhr 1354 Diderot_Mat3x3_t w2i; //!< affine tranform from world space to index space. This is the
158 :     //! inverse of the index to world-space transform that is loaded from
159 :     //! the Nrrd file.
160 :     Diderot_vec3_t tVec; //!< translation part of world to index transform
161 :     Diderot_Mat3x3_t w2iT; //!< transpose w3i
162 : jhr 710 } Diderot_image3D_t;
163 :    
164 :     #endif /* !_DIDEROT_TYPES_H_ */

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