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 710 - (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 :     /* update method return type */
18 :     typedef enum { DIDEROT_DIE, DIDEROT_ACTIVE, DIDEROT_STABILIZE } StrandStatus_t;
19 :    
20 :     /* SSE vector types */
21 :     typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
22 :     #ifdef VEC2_OK
23 :     typedef float vec2f_t __attribute__ ((vector_size (8)));
24 :     #else
25 :     typedef float vec2f_t __attribute__ ((vector_size (16))); // pad so that gcc aligns correctly
26 :     #endif
27 :     typedef float vec4f_t __attribute__ ((vector_size (16)));
28 :     typedef float vec8f_t __attribute__ ((vector_size (32)));
29 :    
30 :     #ifdef VEC2_OK
31 :     typedef int32_t vec2i_t __attribute__ ((vector_size (8)));
32 :     #else
33 :     typedef int32_t vec2i_t __attribute__ ((vector_size (16))); // pad so that gcc aligns correctly
34 :     #endif
35 :     typedef int32_t vec4i_t __attribute__ ((vector_size (16)));
36 :     typedef int32_t vec8i_t __attribute__ ((vector_size (32)));
37 :    
38 :     typedef float vec2d_t __attribute__ ((vector_size (16)));
39 :     typedef float vec4d_t __attribute__ ((vector_size (32)));
40 :     typedef float vec8d_t __attribute__ ((vector_size (64)));
41 :    
42 :     typedef int64_t vec2l_t __attribute__ ((vector_size (16)));
43 :     typedef int64_t vec4l_t __attribute__ ((vector_size (32)));
44 :     typedef int64_t vec8l_t __attribute__ ((vector_size (64)));
45 :    
46 :     typedef union { float r[2]; vec2f_t v; } union2f_t;
47 :     typedef union { float r[4]; vec4f_t v; } union4f_t;
48 :     typedef union { float r[8]; vec8f_t v; } union8f_t;
49 :    
50 :     typedef union { int32_t i[2]; vec2i_t v; } union2i_t;
51 :     typedef union { int32_t i[4]; vec4i_t v; } union4i_t;
52 :     typedef union { int32_t i[8]; vec8i_t v; } union8i_t;
53 :    
54 :     typedef union { double r[2]; vec2d_t v; } union2d_t;
55 :     typedef union { double r[4]; vec4d_t v; } union4d_t;
56 :     typedef union { double r[8]; vec8d_t v; } union8d_t;
57 :    
58 :     typedef union { int64_t r[2]; vec2l_t v; } union2l_t;
59 :     typedef union { int64_t r[4]; vec4l_t v; } union4l_t;
60 :     typedef union { int64_t r[8]; vec8l_t v; } union8l_t;
61 :    
62 :     /* vector lengths must be power of 2, but vec3 is useful, so we pad to 4 */
63 :     typedef vec4f_t vec3f_t;
64 :     typedef union4f_t union3f_t;
65 :     typedef vec4d_t vec3d_t;
66 :     typedef union4d_t union3d_t;
67 :     typedef vec4i_t vec3i_t;
68 :     typedef union4i_t union3i_t;
69 :     typedef vec4l_t vec3l_t;
70 :     typedef union4l_t union3l_t;
71 :    
72 :     /* typedefs for Diderot types */
73 :     #if defined(DIDEROT_SINGLE_PRECISION)
74 :     typedef int32_t Diderot_int_t;
75 :     typedef float Diderot_real_t;
76 :     typedef union4f_t Diderot_vec3_t; // padded to fit in SSE register
77 :     typedef union4f_t Diderot_vec4_t;
78 :     #else
79 :     typedef int64_t Diderot_int_t;
80 :     typedef double Diderot_real_t;
81 :     typedef union4d_t Diderot_vec3_t; // padded to fit in SSE register
82 :     typedef union4d_t Diderot_vec4_t;
83 :     #endif
84 :     typedef const char *Diderot_string_t;
85 :    
86 :     typedef union2f_t Diderot_Mat2x2_t[2]; // represented as row vectors
87 :     typedef union3f_t Diderot_Mat3x3_t[3]; // represented as row vectors
88 :     typedef union4f_t Diderot_Mat4x4_t[4]; // represented as row vectors
89 :    
90 :     typedef struct { // wrapper for 1D image data
91 :     uint32_t dim; // dimension (== 1)
92 :     uint32_t size[1];
93 :     void *data;
94 :     Diderot_Mat2x2_t m; // image to world-space transform
95 :     Diderot_Mat2x2_t mInv; // world to image-space transform (m inverse)
96 :     } Diderot_image1D_t;
97 :    
98 :     typedef struct { // wrapper for 2D image data
99 :     uint32_t dim; // dimension (== 2)
100 :     uint32_t size[2]; // sizes (fast to slow)
101 :     void *data;
102 :     Diderot_Mat3x3_t m; // image to world-space transform
103 :     Diderot_Mat3x3_t mInv; // world to image-space transform (m inverse)
104 :     Diderot_Mat3x3_t mInvT; // image to world-space transform for gradients
105 :     // (m inverse transpose)
106 :     } Diderot_image2D_t;
107 :    
108 :     typedef struct { // wrapper for 3D image data
109 :     uint32_t dim; // dimension (== 3)
110 :     uint32_t size[3]; // sizes (fast to slow)
111 :     void *data;
112 :     Diderot_Mat4x4_t m; // image to world-space transform
113 :     Diderot_Mat4x4_t mInv; // world to image-space transform (m inverse)
114 :     Diderot_Mat4x4_t mInvT; // image to world-space transform for gradients
115 :     // (m inverse transpose)
116 :     } Diderot_image3D_t;
117 :    
118 :     #endif /* !_DIDEROT_TYPES_H_ */

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