00001 #if !defined(__VECTOR_TYPES_H__)
00002 #define __VECTOR_TYPES_H__
00003
00004 #ifndef __CUDACC__
00005 #define __builtin_align__(a)
00006 #define __inline__ inline
00007 #define __host__
00008 #define __device__
00009 #else
00010 #define __builtin_align__(a) __align__(a)
00011 #define __inline__ inline
00012 #endif
00013
00014 struct char1{
00015 signed char x;
00016 };
00017
00018 struct uchar1{
00019 unsigned char x;
00020 };
00021
00022 struct __builtin_align__(2) char2{
00023 signed char x, y;
00024 };
00025
00026 struct __builtin_align__(2) uchar2{
00027 unsigned char x, y;
00028 };
00029
00030 struct char3{
00031 signed char x, y, z;
00032 };
00033
00034 struct uchar3{
00035 unsigned char x, y, z;
00036 };
00037
00038 struct __builtin_align__(4) char4{
00039 signed char x, y, z, w;
00040 };
00041
00042 struct __builtin_align__(4) uchar4{
00043 unsigned char x, y, z, w;
00044 };
00045
00046 struct short1{
00047 short x;
00048 };
00049
00050 struct ushort1{
00051 unsigned short x;
00052 };
00053
00054 struct __builtin_align__(4) short2{
00055 short x, y;
00056 };
00057
00058 struct __builtin_align__(4) ushort2{
00059 unsigned short x, y;
00060 };
00061
00062 struct short3{
00063 short x, y, z;
00064 };
00065
00066 struct ushort3{
00067 unsigned short x, y, z;
00068 };
00069
00070 struct __builtin_align__(8) short4{
00071 short x, y, z, w;
00072 };
00073
00074 struct __builtin_align__(8) ushort4{
00075 unsigned short x, y, z, w;
00076 };
00077
00078 struct int1{
00079 int x;
00080 };
00081
00082 struct uint1{
00083 unsigned int x;
00084 };
00085
00086 struct __builtin_align__(8) int2{
00087 int x, y;
00088 };
00089
00090 struct __builtin_align__(8) uint2{
00091 unsigned int x, y;
00092 };
00093
00094 struct int3{
00095 int x, y, z;
00096 };
00097
00098 struct uint3{
00099 unsigned int x, y, z;
00100 };
00101
00102 struct __builtin_align__(16) int4{
00103 int x, y, z, w;
00104 };
00105
00106 struct __builtin_align__(16) uint4{
00107 unsigned int x, y, z, w;
00108 };
00109
00110 struct long1{
00111 long int x;
00112 };
00113
00114 struct ulong1{
00115 unsigned long x;
00116 };
00117
00118
00119 struct
00120 #ifdef _WIN32
00121 __builtin_align__(8)
00122 #else
00123 __builtin_align__(2*sizeof(long int))
00124 #endif
00125
00126 long2{
00127 long int x, y;
00128 };
00129
00130
00131 struct
00132 #ifdef _WIN32
00133 __builtin_align__(8)
00134 #else
00135 __builtin_align__(2*sizeof(unsigned long int))
00136 #endif
00137
00138 ulong2{
00139 unsigned long int x, y;
00140 };
00141
00142 #ifndef __LP64__
00143
00144 struct long3{
00145 long int x, y, z;
00146 };
00147
00148 struct ulong3{
00149 unsigned long int x, y, z;
00150 };
00151
00152 struct __builtin_align__(16) long4{
00153 long int x, y, z, w;
00154 };
00155
00156 struct __builtin_align__(16) ulong4{
00157 unsigned long int x, y, z, w;
00158 };
00159
00160 #endif
00161
00162
00163 struct float1{
00164 float x;
00165 };
00166
00167 struct __builtin_align__(8) float2{
00168 float x, y;
00169 };
00170
00171 struct float3{
00172 float x, y, z;
00173 };
00174
00175 struct __builtin_align__(16) float4{
00176 float x, y, z, w;
00177 };
00178
00179 struct longlong1{
00180 long long int x;
00181 };
00182
00183 struct ulonglong1{
00184 unsigned long long int x;
00185 };
00186
00187 struct __builtin_align__(16) longlong2{
00188 long long int x, y;
00189 };
00190
00191 struct __builtin_align__(16) ulonglong2{
00192 unsigned long long int x, y;
00193 };
00194
00195 struct double1{
00196 double x;
00197 };
00198
00199 struct __builtin_align__(16) double2{
00200 double x, y;
00201 };
00202
00203 struct double3{
00204 double x, y, z;
00205 };
00206
00207 struct __builtin_align__(32) double4{
00208 double x, y, z, w;
00209 };
00210
00211
00212
00213
00214
00215
00216
00217
00218 typedef struct char1 char1;
00219
00220 typedef struct uchar1 uchar1;
00221
00222 typedef struct char2 char2;
00223
00224 typedef struct uchar2 uchar2;
00225
00226 typedef struct char3 char3;
00227
00228 typedef struct uchar3 uchar3;
00229
00230 typedef struct char4 char4;
00231
00232 typedef struct uchar4 uchar4;
00233
00234 typedef struct short1 short1;
00235
00236 typedef struct ushort1 ushort1;
00237
00238 typedef struct short2 short2;
00239
00240 typedef struct ushort2 ushort2;
00241
00242 typedef struct short3 short3;
00243
00244 typedef struct ushort3 ushort3;
00245
00246 typedef struct short4 short4;
00247
00248 typedef struct ushort4 ushort4;
00249
00250 typedef struct int1 int1;
00251
00252 typedef struct uint1 uint1;
00253
00254 typedef struct int2 int2;
00255
00256 typedef struct uint2 uint2;
00257
00258 typedef struct int3 int3;
00259
00260 typedef struct uint3 uint3;
00261
00262 typedef struct int4 int4;
00263
00264 typedef struct uint4 uint4;
00265
00266 typedef struct long1 long1;
00267
00268 typedef struct ulong1 ulong1;
00269
00270 typedef struct long2 long2;
00271
00272 typedef struct ulong2 ulong2;
00273
00274 typedef struct long3 long3;
00275
00276 typedef struct ulong3 ulong3;
00277
00278 typedef struct long4 long4;
00279
00280 typedef struct ulong4 ulong4;
00281
00282 typedef struct float1 float1;
00283
00284 typedef struct float2 float2;
00285
00286 typedef struct float3 float3;
00287
00288 typedef struct float4 float4;
00289
00290 typedef struct longlong1 longlong1;
00291
00292 typedef struct ulonglong1 ulonglong1;
00293
00294 typedef struct longlong2 longlong2;
00295
00296 typedef struct ulonglong2 ulonglong2;
00297
00298 typedef struct double1 double1;
00299
00300 typedef struct double2 double2;
00301
00302 typedef struct double3 double3;
00303
00304 typedef struct double4 double4;
00305
00306
00307
00308
00309
00310
00311
00312
00313 typedef struct dim3 dim3;
00314
00315
00316 struct dim3
00317 {
00318 unsigned int x, y, z;
00319 #ifdef __cplusplus
00320 dim3(unsigned int x = 1, unsigned int y = 1, unsigned int z = 1) : x(x), y(y), z(z) {}
00321 dim3(uint3 v) : x(v.x), y(v.y), z(v.z) {}
00322 operator uint3(void) { uint3 t; t.x = x; t.y = y; t.z = z; return t; }
00323 #endif
00324 };
00325
00326
00327
00328
00329 static __inline__ __host__ __device__ char1 make_char1(signed char x){
00330 char1 t; t.x = x; return t;
00331 }
00332
00333 static __inline__ __host__ __device__ uchar1 make_uchar1(unsigned char x){
00334 uchar1 t; t.x = x; return t;
00335 }
00336
00337 static __inline__ __host__ __device__ char2 make_char2(signed char x, signed char y){
00338 char2 t; t.x = x; t.y = y; return t;
00339 }
00340
00341 static __inline__ __host__ __device__ uchar2 make_uchar2(unsigned char x, unsigned char y){
00342 uchar2 t; t.x = x; t.y = y; return t;
00343 }
00344
00345 static __inline__ __host__ __device__ char3 make_char3(signed char x, signed char y, signed char z){
00346 char3 t; t.x = x; t.y = y; t.z = z; return t;
00347 }
00348
00349 static __inline__ __host__ __device__ uchar3 make_uchar3(unsigned char x, unsigned char y, unsigned char z){
00350 uchar3 t; t.x = x; t.y = y; t.z = z; return t;
00351 }
00352
00353 static __inline__ __host__ __device__ char4 make_char4(signed char x, signed char y, signed char z, signed char w){
00354 char4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00355 }
00356
00357 static __inline__ __host__ __device__ uchar4 make_uchar4(unsigned char x, unsigned char y, unsigned char z, unsigned char w){
00358 uchar4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00359 }
00360
00361 static __inline__ __host__ __device__ short1 make_short1(short x){
00362 short1 t; t.x = x; return t;
00363 }
00364
00365 static __inline__ __host__ __device__ ushort1 make_ushort1(unsigned short x){
00366 ushort1 t; t.x = x; return t;
00367 }
00368
00369 static __inline__ __host__ __device__ short2 make_short2(short x, short y){
00370 short2 t; t.x = x; t.y = y; return t;
00371 }
00372
00373 static __inline__ __host__ __device__ ushort2 make_ushort2(unsigned short x, unsigned short y){
00374 ushort2 t; t.x = x; t.y = y; return t;
00375 }
00376
00377 static __inline__ __host__ __device__ short3 make_short3(short x,short y, short z){
00378 short3 t; t.x = x; t.y = y; t.z = z; return t;
00379 }
00380
00381 static __inline__ __host__ __device__ ushort3 make_ushort3(unsigned short x, unsigned short y, unsigned short z){
00382 ushort3 t; t.x = x; t.y = y; t.z = z; return t;
00383 }
00384
00385 static __inline__ __host__ __device__ short4 make_short4(short x, short y, short z, short w){
00386 short4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00387 }
00388
00389 static __inline__ __host__ __device__ ushort4 make_ushort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w){
00390 ushort4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00391 }
00392
00393 static __inline__ __host__ __device__ int1 make_int1(int x){
00394 int1 t; t.x = x; return t;
00395 }
00396
00397 static __inline__ __host__ __device__ uint1 make_uint1(unsigned int x){
00398 uint1 t; t.x = x; return t;
00399 }
00400
00401 static __inline__ __host__ __device__ int2 make_int2(int x, int y){
00402 int2 t; t.x = x; t.y = y; return t;
00403 }
00404
00405 static __inline__ __host__ __device__ uint2 make_uint2(unsigned int x, unsigned int y){
00406 uint2 t; t.x = x; t.y = y; return t;
00407 }
00408
00409 static __inline__ __host__ __device__ int3 make_int3(int x, int y, int z){
00410 int3 t; t.x = x; t.y = y; t.z = z; return t;
00411 }
00412
00413 static __inline__ __host__ __device__ uint3 make_uint3(unsigned int x, unsigned int y, unsigned int z){
00414 uint3 t; t.x = x; t.y = y; t.z = z; return t;
00415 }
00416
00417 static __inline__ __host__ __device__ int4 make_int4(int x, int y, int z, int w){
00418 int4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00419 }
00420
00421 static __inline__ __host__ __device__ uint4 make_uint4(unsigned int x, unsigned int y, unsigned int z, unsigned int w){
00422 uint4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00423 }
00424
00425 static __inline__ __host__ __device__ long1 make_long1(long int x){
00426 long1 t; t.x = x; return t;
00427 }
00428
00429 static __inline__ __host__ __device__ ulong1 make_ulong1(unsigned long int x){
00430 ulong1 t; t.x = x; return t;
00431 }
00432
00433 static __inline__ __host__ __device__ long2 make_long2(long int x, long int y){
00434 long2 t; t.x = x; t.y = y; return t;
00435 }
00436
00437 static __inline__ __host__ __device__ ulong2 make_ulong2(unsigned long int x, unsigned long int y){
00438 ulong2 t; t.x = x; t.y = y; return t;
00439 }
00440
00441 #ifndef __LP64__
00442
00443 static __inline__ __host__ __device__ long3 make_long3(long int x, long int y, long int z){
00444 long3 t; t.x = x; t.y = y; t.z = z; return t;
00445 }
00446
00447 static __inline__ __host__ __device__ ulong3 make_ulong3(unsigned long int x, unsigned long int y, unsigned long int z){
00448 ulong3 t; t.x = x; t.y = y; t.z = z; return t;
00449 }
00450
00451 static __inline__ __host__ __device__ long4 make_long4(long int x, long int y, long int z, long int w){
00452 long4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00453 }
00454
00455 static __inline__ __host__ __device__ ulong4 make_ulong4(unsigned long int x, unsigned long int y, unsigned long int z, unsigned long int w){
00456 ulong4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00457 }
00458
00459 #endif
00460
00461 static __inline__ __host__ __device__ float1 make_float1(float x){
00462 float1 t; t.x = x; return t;
00463 }
00464
00465 static __inline__ __host__ __device__ float2 make_float2(float x, float y){
00466 float2 t; t.x = x; t.y = y; return t;
00467 }
00468
00469 static __inline__ __host__ __device__ float3 make_float3(float x, float y, float z){
00470 float3 t; t.x = x; t.y = y; t.z = z; return t;
00471 }
00472
00473 static __inline__ __host__ __device__ float4 make_float4(float x, float y, float z, float w){
00474 float4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00475 }
00476
00477 static __inline__ __host__ __device__ longlong1 make_longlong1(long long int x){
00478 longlong1 t; t.x = x; return t;
00479 }
00480
00481 static __inline__ __host__ __device__ ulonglong1 make_ulonglong1(unsigned long long int x){
00482 ulonglong1 t; t.x = x; return t;
00483 }
00484
00485 static __inline__ __host__ __device__ longlong2 make_longlong2(long long int x, long long int y){
00486 longlong2 t; t.x = x; t.y = y; return t;
00487 }
00488
00489 static __inline__ __host__ __device__ ulonglong2 make_ulonglong2(unsigned long long int x, unsigned long long int y){
00490 ulonglong2 t; t.x = x; t.y = y; return t;
00491 }
00492
00493 static __inline__ __host__ __device__ double1 make_double1(double x){
00494 double1 t; t.x = x; return t;
00495 }
00496
00497 static __inline__ __host__ __device__ double2 make_double2(double x, double y){
00498 double2 t; t.x = x; t.y = y; return t;
00499 }
00500
00501 static __inline__ __host__ __device__ double3 make_double3(double x, double y, double z){
00502 double3 t; t.x = x; t.y = y; t.z = z; return t;
00503 }
00504
00505 static __inline__ __host__ __device__ double4 make_double4(double x, double y, double z, double w){
00506 double4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
00507 }
00508
00509 #endif