Lines Matching refs:type
48 struct lp_type type)
51 type.sign ? (type.floating || type.fixed ? "" : "s") : "u",
52 type.floating ? "f" : (type.fixed ? "h" : "i"),
53 type.width,
54 type.norm ? "n" : "",
55 type.length);
60 read_elem(struct lp_type type, const void *src, unsigned index)
62 double scale = lp_const_scale(type);
64 assert(index < type.length);
65 if (type.floating) {
66 switch(type.width) {
79 if(type.sign) {
80 switch(type.width) {
99 switch(type.width) {
123 write_elem(struct lp_type type, void *dst, unsigned index, double value)
125 assert(index < type.length);
126 if(!type.sign && value < 0.0)
128 if(type.norm && value < -1.0)
130 if(type.norm && value > 1.0)
132 if (type.floating) {
133 switch(type.width) {
145 double scale = lp_const_scale(type);
147 if(type.sign) {
149 lvalue = MIN2(lvalue, ((long long)1 << (type.width - 1)) - 1);
150 switch(type.width) {
169 lvalue = MIN2(lvalue, ((unsigned long long)1 << type.width) - 1);
170 switch(type.width) {
192 random_elem(struct lp_type type, void *dst, unsigned index)
195 assert(index < type.length);
197 if(!type.norm) {
198 if (type.floating) {
203 if (type.fixed)
204 mask = ((unsigned long long)1 << (type.width / 2)) - 1;
205 else if (type.sign)
206 mask = ((unsigned long long)1 << (type.width - 1)) - 1;
208 mask = ((unsigned long long)1 << type.width) - 1;
212 if(!type.sign)
215 write_elem(type, dst, index, value);
220 read_vec(struct lp_type type, const void *src, double *dst)
223 for (i = 0; i < type.length; ++i)
224 dst[i] = read_elem(type, src, i);
229 write_vec(struct lp_type type, void *dst, const double *src)
232 for (i = 0; i < type.length; ++i)
233 write_elem(type, dst, i, src[i]);
245 random_vec(struct lp_type type, void *dst)
248 for (i = 0; i < type.length; ++i)
249 random_elem(type, dst, i);
254 compare_vec_with_eps(struct lp_type type, const void *res, const void *ref, double eps)
257 eps *= type.floating ? 8.0 : 2.0;
258 for (i = 0; i < type.length; ++i) {
259 double res_elem = read_elem(type, res, i);
260 double ref_elem = read_elem(type, ref, i);
276 compare_vec(struct lp_type type, const void *res, const void *ref)
278 double eps = lp_const_eps(type);
279 return compare_vec_with_eps(type, res, ref, eps);
284 dump_vec(FILE *fp, struct lp_type type, const void *src)
287 for (i = 0; i < type.length; ++i) {
290 if (type.floating) {
292 switch(type.width) {
306 if(type.sign && !type.norm) {
309 switch(type.width) {
336 switch(type.width) {
339 format = type.norm ? "%2x" : "%4llu";
343 format = type.norm ? "%4x" : "%6llx";
347 format = type.norm ? "%8x" : "%11llx";
351 format = type.norm ? "%16x" : "%21llx";