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

SCM Repository

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

Diff of /branches/pure-cfg/src/include/Diderot/diderot.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 559, Tue Feb 22 20:09:41 2011 UTC revision 560, Tue Feb 22 22:14:12 2011 UTC
# Line 30  Line 30 
30  typedef float vec4f __attribute__ ((vector_size (16)));  typedef float vec4f __attribute__ ((vector_size (16)));
31  typedef float vec8f __attribute__ ((vector_size (32)));  typedef float vec8f __attribute__ ((vector_size (32)));
32    
33    typedef int32_t vec2i __attribute__ ((vector_size (8)));
34    typedef int32_t vec4i __attribute__ ((vector_size (16)));
35    typedef int32_t vec8i __attribute__ ((vector_size (32)));
36    
37  typedef float vec2d __attribute__ ((vector_size (16)));  typedef float vec2d __attribute__ ((vector_size (16)));
38  typedef float vec4d __attribute__ ((vector_size (32)));  typedef float vec4d __attribute__ ((vector_size (32)));
39  typedef float vec8d __attribute__ ((vector_size (64)));  typedef float vec8d __attribute__ ((vector_size (64)));
40    
41    typedef int64_t vec2l __attribute__ ((vector_size (16)));
42    typedef int64_t vec4l __attribute__ ((vector_size (32)));
43    typedef int64_t vec8l __attribute__ ((vector_size (64)));
44    
45  typedef union { float r[2]; vec2f v; } union2f;  typedef union { float r[2]; vec2f v; } union2f;
46  typedef union { float r[4]; vec4f v; } union4f;  typedef union { float r[4]; vec4f v; } union4f;
47  typedef union { float r[8]; vec8f v; } union8f;  typedef union { float r[8]; vec8f v; } union8f;
48    
49    typedef union { int32_t i[2]; vec2i v; } union2i;
50    typedef union { int32_t i[4]; vec4i v; } union4i;
51    typedef union { int32_t i[8]; vec8i v; } union8i;
52    
53  typedef union { double r[2]; vec2d v; } union2d;  typedef union { double r[2]; vec2d v; } union2d;
54  typedef union { double r[4]; vec4d v; } union4d;  typedef union { double r[4]; vec4d v; } union4d;
55  typedef union { double r[8]; vec8d v; } union8d;  typedef union { double r[8]; vec8d v; } union8d;
56    
57  typedef int32_t vec2i __attribute__ ((vector_size (8)));  typedef union { int64_t r[2]; vec2l v; } union2l;
58  typedef int32_t vec4i __attribute__ ((vector_size (16)));  typedef union { int64_t r[4]; vec4l v; } union4l;
59  typedef int32_t vec8i __attribute__ ((vector_size (32)));  typedef union { int64_t r[8]; vec8l v; } union8l;
60    
61  /* vector lengths must be power of 2, but vec3 is useful, so we pad to 4 */  /* vector lengths must be power of 2, but vec3 is useful, so we pad to 4 */
62  typedef vec4f vec3f;  typedef vec4f vec3f;
63  typedef vec4d vec3d;  typedef vec4d vec3d;
64    typedef vec4i vec3i;
65    typedef vec4l vec3l;
66    
67  /* typedefs for Diderot types */  /* typedefs for Diderot types */
68    #if defined(DIDEROT_SINGLE_PRECISION)
69  typedef int32_t Diderot_int_t;  typedef int32_t Diderot_int_t;
70  typedef float Diderot_real_t;  typedef float Diderot_real_t;
71  typedef union4f Diderot_vec3_t; // padded to fit in SSE register  typedef union4f Diderot_vec3_t; // padded to fit in SSE register
72  typedef union4f Diderot_vec4_t;  typedef union4f Diderot_vec4_t;
73    #else
74    typedef int64_t Diderot_int_t;
75    typedef double Diderot_real_t;
76    typedef union4d Diderot_vec3_t; // padded to fit in SSE register
77    typedef union4d Diderot_vec4_t;
78    #endif
79  typedef const char *Diderot_string_t;  typedef const char *Diderot_string_t;
80    
81  typedef Diderot_real_t Diderot_Mat2x2_t[4];  typedef Diderot_real_t Diderot_Mat2x2_t[4];
# Line 101  Line 122 
122  extern Status_t Diderot_InputReal (const char *, Diderot_real_t *, bool);  extern Status_t Diderot_InputReal (const char *, Diderot_real_t *, bool);
123  extern Status_t Diderot_InputVec3 (const char *, Diderot_vec3_t *, bool);  extern Status_t Diderot_InputVec3 (const char *, Diderot_vec3_t *, bool);
124    
125  /* inline vector arithmetic functions */  /********** 3-element vector functions **********/
126    
127  STATIC_INLINE vec3f Diderot_Vec3 (Diderot_real_t a, Diderot_real_t b, Diderot_real_t c)  STATIC_INLINE vec3f Diderot_Vec3 (Diderot_real_t a, Diderot_real_t b, Diderot_real_t c)
128  {  {
129      return __extension__ (vec4f){ a, b, c, 0.0f };      return __extension__ (vec4f){ a, b, c, 0.0f };
130  }  }
131    
132  STATIC_INLINE vec4f Diderot_Vec4 (Diderot_real_t a, Diderot_real_t b, Diderot_real_t c, Diderot_real_t d)  STATIC_INLINE vec4f Diderot_ScaleV3 (Diderot_real_t s, vec4f v)
133  {  {
134      return __extension__ (vec4f){ a, b, c, d };      return Diderot_Vec3(s, s, s) * v;
135  }  }
136    
137  STATIC_INLINE vec4f Diderot_ScaleV3 (vec4f dstV, Diderot_real_t s, vec4f v)  STATIC_INLINE vec3i Diderot_TruncToIntV3 (vec3f v)
138  {  {
139      return Diderot_Vec3(s, s, s) * v;      union4f t;
140        t.v = v;
141        return __extension__ (vec4i){
142            (int32_t)truncf(t.r[0]),
143            (int32_t)truncf(t.r[1]),
144            (int32_t)truncf(t.r[2]),
145            0 };
146  }  }
147    
148    
149    /********** 4-element vector functions **********/
150    
151    STATIC_INLINE vec4f Diderot_Vec4 (Diderot_real_t a, Diderot_real_t b, Diderot_real_t c, Diderot_real_t d)
152    {
153        return __extension__ (vec4f){ a, b, c, d };
154    }
155    
156    
157    /********** other Diderot support functions **********/
158    
159  // check if pos is inside the img, assuming that we have a border of width s.  // check if pos is inside the img, assuming that we have a border of width s.
160  //  //
161  STATIC_INLINE bool Diderot_Inside3D (Diderot_vec3_t pos, Diderot_image3D_t *img, int s)  STATIC_INLINE bool Diderot_Inside3D (Diderot_vec3_t pos, Diderot_image3D_t *img, int s)

Legend:
Removed from v.559  
changed lines
  Added in v.560

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