36 #include <vector_types.h>
40 #define MGPU_RAND_NS std::tr1
55 va_start(args, format);
56 int len = vsnprintf(0, 0, format, args);
63 va_start(args, format);
64 vsnprintf(&text[0], len + 1, format, args);
74 else if(x < 1000000) {
79 }
else if(x < 1000000000ll) {
80 if(0 == (x % 1000000ll))
85 if(0 == (x % 1000000000ll))
94 typedef std::map<std::string, const char*> Map;
97 void Insert(
const std::type_info& ti,
const char*
name) {
98 _map[ti.name()] =
name;
102 Insert(
typeid(
char),
"char");
103 Insert(
typeid(
byte),
"byte");
104 Insert(
typeid(
short),
"short");
105 Insert(
typeid(
ushort),
"ushort");
106 Insert(
typeid(
int),
"int");
107 Insert(
typeid(
int64),
"int64");
108 Insert(
typeid(
uint),
"uint");
109 Insert(
typeid(
uint64),
"uint64");
110 Insert(
typeid(
float),
"float");
111 Insert(
typeid(
double),
"double");
112 Insert(
typeid(int2),
"int2");
113 Insert(
typeid(int3),
"int3");
114 Insert(
typeid(int4),
"int4");
115 Insert(
typeid(uint2),
"uint2");
116 Insert(
typeid(uint3),
"uint3");
117 Insert(
typeid(uint4),
"uint4");
118 Insert(
typeid(float2),
"float2");
119 Insert(
typeid(float3),
"float3");
120 Insert(
typeid(float4),
"float4");
121 Insert(
typeid(double2),
"double2");
122 Insert(
typeid(double3),
"double3");
123 Insert(
typeid(double4),
"double4");
124 Insert(
typeid(
char*),
"char*");
126 const char*
name(
const std::type_info& ti) {
127 const char* n = ti.name();
128 Map::iterator it = _map.find(n);
137 return typeIdMap.
name(ti);
146 MGPU_RAND_NS::uniform_int<int> r(min, max);
150 MGPU_RAND_NS::uniform_int<int64> r(min, max);
154 MGPU_RAND_NS::uniform_int<uint> r(min, max);
158 MGPU_RAND_NS::uniform_int<uint64> r(min, max);
162 MGPU_RAND_NS::uniform_real<float> r(min, max);
166 MGPU_RAND_NS::uniform_real<double> r(min, max);