Changes in uspace/app/tester/float/softfloat1.c [c0f8909:000494d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/float/softfloat1.c
rc0f8909 r000494d 34 34 #include <mul.h> 35 35 #include <div.h> 36 #include <comparison.h>37 36 #include <bool.h> 38 37 #include "../tester.h" … … 46 45 typedef void (* float_op_t)(float, float, float *, float_t *); 47 46 typedef void (* double_op_t)(double, double, double *, double_t *); 48 typedef void (* double_cmp_op_t)(double, double, cmptype_t *, cmptype_t *);49 47 typedef void (* template_t)(void *, unsigned, unsigned, cmptype_t *, 50 48 cmptype_t *); … … 68 66 69 67 return -a; 70 }71 72 static int dcmp(double a, double b)73 {74 if (a < b)75 return -1;76 else if (a > b)77 return 1;78 79 return 0;80 68 } 81 69 … … 108 96 *pic = (cmptype_t) (c * PRECISION); 109 97 *pisc = (cmptype_t) (sc.val * PRECISION); 110 }111 112 static void113 double_compare_template(void *f, unsigned i, unsigned j, cmptype_t *pis,114 cmptype_t *piss)115 {116 double_cmp_op_t op = (double_cmp_op_t) f;117 118 op(dop_a[i], dop_b[j], pis, piss);119 98 } 120 99 … … 242 221 } 243 222 244 static void245 double_cmp_operator(double a, double b, cmptype_t *pis, cmptype_t *piss)246 {247 *pis = dcmp(a, b);248 249 double_t sa;250 double_t sb;251 252 sa.val = a;253 sb.val = b;254 255 if (is_double_lt(sa.data, sb.data))256 *piss = -1;257 else if (is_double_gt(sa.data, sb.data))258 *piss = 1;259 else if (is_double_eq(sa.data, sb.data))260 *piss = 0;261 else262 *piss = 42;263 }264 265 223 const char *test_softfloat1(void) 266 224 { … … 291 249 TPRINTF("%s\n", err); 292 250 } 293 if (!test_template(double_compare_template, double_cmp_operator)) {294 err = "Double comparison failed";295 TPRINTF("%s\n", err);296 }297 251 298 252 return err;
Note:
See TracChangeset
for help on using the changeset viewer.