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 1131 - (view) (download) (as text)

1 : jhr 1115 /*! \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 1131 /*! \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 1115
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 :     typedef float vec2d_t __attribute__ ((vector_size (16)));
49 :     typedef float vec4d_t __attribute__ ((vector_size (32)));
50 :     typedef float vec8d_t __attribute__ ((vector_size (64)));
51 :    
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 int32_t Diderot_int_t;
85 :     typedef float Diderot_real_t;
86 :     typedef union4f_t Diderot_vec3_t; // padded to fit in SSE register
87 :     typedef union4f_t Diderot_vec4_t;
88 :     #else
89 :     typedef int64_t Diderot_int_t;
90 :     typedef double Diderot_real_t;
91 :     typedef union4d_t Diderot_vec3_t; // padded to fit in SSE register
92 :     typedef union4d_t Diderot_vec4_t;
93 :     #endif
94 :     typedef const char *Diderot_string_t;
95 :    
96 :     typedef union2f_t Diderot_Mat2x2_t[2]; // represented as row vectors
97 :     typedef union3f_t Diderot_Mat3x3_t[3]; // represented as row vectors
98 :     typedef union4f_t Diderot_Mat4x4_t[4]; // represented as row vectors
99 :    
100 :     typedef struct { // wrapper for 1D image data
101 :     uint32_t dim; // dimension (== 1)
102 :     uint32_t size[1];
103 :     void *data;
104 :     float s; // scaling from world-space to image-space
105 :     float t; // translation from world-space to image-space
106 :     } Diderot_image1D_t;
107 :    
108 :     typedef struct { // wrapper for 2D image data
109 :     uint32_t dim; // dimension (== 2)
110 :     uint32_t size[2]; // sizes (fast to slow)
111 :     void *data;
112 :     Diderot_Mat2x2_t w2i; // affine tranform from world space to index space. This is the
113 :     // inverse of the index to world-space transform that is loaded from
114 :     // the Nrrd file.
115 :     vec2f_t tVec; // translation part of world to index transform
116 :     Diderot_Mat2x2_t w2iT; // transpose w3i
117 :     } Diderot_image2D_t;
118 :    
119 :     typedef struct { // wrapper for 3D image data
120 :     uint32_t dim; // dimension (== 3)
121 :     uint32_t size[3]; // sizes (fast to slow)
122 :     void *data;
123 :     Diderot_Mat3x3_t w2i; // affine tranform from world space to index space. This is the
124 :     // inverse of the index to world-space transform that is loaded from
125 :     // the Nrrd file.
126 :     vec3f_t tVec; // translation part of world to index transform
127 :     Diderot_Mat3x3_t w2iT; // transpose w3i
128 :     } Diderot_image3D_t;
129 :    
130 :     #endif /* !_DIDEROT_TYPES_H_ */

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