diff options
Diffstat (limited to 'tools/lib/h5diff_array.c')
-rw-r--r-- | tools/lib/h5diff_array.c | 201 |
1 files changed, 101 insertions, 100 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 9b680ec..1a4c727 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -134,7 +134,7 @@ typedef struct mcomp_t { */ static hbool_t all_zero(const void *_mem, size_t size); static int ull2float(unsigned long long ull_value, float *f_value); -static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, ssize_t u, diff_opt_t *opts); +static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts); static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, diff_opt_t *opts); static hbool_t equal_float(float value, float expected, diff_opt_t *opts); static hbool_t equal_double(double value, double expected, diff_opt_t *opts); @@ -143,7 +143,7 @@ static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t #endif static int print_data(diff_opt_t *opts); -static void print_pos(diff_opt_t *opts, hsize_t elemtno, ssize_t u); +static void print_pos(diff_opt_t *opts, hsize_t elemtno, size_t u); static void h5diff_print_char(char ch); static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts); @@ -210,7 +210,6 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_ unsigned char *mem1 = (unsigned char*) _mem1; unsigned char *mem2 = (unsigned char*) _mem2; hsize_t i; - int j; mcomp_t members; H5T_class_t type_class; @@ -680,7 +679,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co */ nfound += 1; opts->print_percentage = 0; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(S_FORMAT, enum_name1, enum_name2); } @@ -690,7 +689,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co if (HDstrcmp(enum_name1, enum_name2) != 0) { nfound = 1; opts->print_percentage = 0; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(S_FORMAT, enum_name1, enum_name2); } @@ -1528,7 +1527,7 @@ done: *------------------------------------------------------------------------- */ -static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, ssize_t u, diff_opt_t *opts) +static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts) { hsize_t nfound = 0; /* differences found */ char temp1_uchar; @@ -1541,6 +1540,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, ssize_ if (temp1_uchar != temp2_uchar) { if (print_data(opts)) { opts->print_percentage = 0; + opts->print_dims = 1; print_pos(opts, elemtno, u); parallel_print(" "); h5diff_print_char(temp1_uchar); @@ -1580,7 +1580,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -1592,7 +1592,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } @@ -1604,7 +1604,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } @@ -1613,7 +1613,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h } else if (temp1_uchar != temp2_uchar) { opts->print_percentage = 0; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -1668,7 +1668,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz if (!isnan1 && !isnan2) { if ((double) ABS(temp1_float - temp2_float) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1678,7 +1678,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1704,7 +1704,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1712,7 +1712,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); @@ -1723,7 +1723,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1750,7 +1750,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1758,7 +1758,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); @@ -1769,7 +1769,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1783,7 +1783,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz else { if (equal_float(temp1_float, temp2_float, opts) == FALSE) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1836,7 +1836,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi if (!isnan1 && !isnan2) { if (ABS(temp1_double-temp2_double) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1846,7 +1846,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1873,7 +1873,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1881,7 +1881,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); @@ -1892,7 +1892,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1919,7 +1919,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1927,7 +1927,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); @@ -1938,7 +1938,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1952,7 +1952,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi else { if (equal_double(temp1_double, temp2_double, opts) == FALSE) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2009,7 +2009,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs if (!isnan1 && !isnan2) { if (ABS(temp1_double-temp2_double) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2019,7 +2019,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2046,7 +2046,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2054,7 +2054,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); } @@ -2064,7 +2064,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2091,7 +2091,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2099,7 +2099,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs } else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); } @@ -2109,7 +2109,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2122,7 +2122,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs */ else if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2159,7 +2159,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_char-temp2_char) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } @@ -2172,7 +2172,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } @@ -2180,7 +2180,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); } @@ -2193,7 +2193,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } @@ -2201,7 +2201,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && ABS(temp1_char - temp2_char) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); } @@ -2210,7 +2210,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (temp1_char != temp2_char) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } @@ -2246,7 +2246,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -2259,7 +2259,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -2267,7 +2267,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } @@ -2280,7 +2280,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -2288,7 +2288,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && PDIFF(temp1_uchar, temp2_uchar) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } @@ -2297,7 +2297,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (temp1_uchar != temp2_uchar) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -2333,7 +2333,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_short - temp2_short) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } @@ -2346,7 +2346,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } @@ -2354,7 +2354,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); } @@ -2367,7 +2367,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } @@ -2375,7 +2375,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && ABS(temp1_short - temp2_short) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); } @@ -2384,7 +2384,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (temp1_short != temp2_short) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } @@ -2420,7 +2420,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_ushort, temp2_ushort) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } @@ -2433,7 +2433,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } @@ -2441,7 +2441,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); } @@ -2454,7 +2454,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } @@ -2462,7 +2462,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent && PDIFF(temp1_ushort, temp2_ushort) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); } @@ -2471,7 +2471,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (temp1_ushort != temp2_ushort) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } @@ -2507,7 +2507,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_int-temp2_int) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } @@ -2520,7 +2520,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } @@ -2528,7 +2528,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); } @@ -2541,7 +2541,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } @@ -2549,7 +2549,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ } else if (per > opts->percent && ABS(temp1_int - temp2_int) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); } @@ -2558,7 +2558,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ } else if (temp1_int != temp2_int) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } @@ -2594,7 +2594,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_uint, temp2_uint) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } @@ -2607,7 +2607,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } @@ -2615,7 +2615,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); } @@ -2628,7 +2628,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } @@ -2636,7 +2636,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (per > opts->percent && PDIFF(temp1_uint,temp2_uint) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); } @@ -2645,7 +2645,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (temp1_uint != temp2_uint) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } @@ -2681,7 +2681,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_long-temp2_long) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } @@ -2694,7 +2694,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } @@ -2702,7 +2702,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); } @@ -2715,7 +2715,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } @@ -2723,7 +2723,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); } @@ -2732,7 +2732,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (temp1_long != temp2_long) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } @@ -2768,7 +2768,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_ulong, temp2_ulong) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } @@ -2781,7 +2781,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } @@ -2789,7 +2789,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); } @@ -2802,7 +2802,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } @@ -2810,7 +2810,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); } @@ -2819,7 +2819,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (temp1_ulong != temp2_ulong) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } @@ -2856,7 +2856,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (ABS( temp1_llong-temp2_llong) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } @@ -2869,7 +2869,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } @@ -2877,7 +2877,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per); } @@ -2890,7 +2890,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } @@ -2898,7 +2898,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && ABS(temp1_llong-temp2_llong) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per); } @@ -2908,7 +2908,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz else { if (temp1_llong != temp2_llong) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } @@ -2947,7 +2947,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } @@ -2962,7 +2962,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } @@ -2970,7 +2970,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong,temp2_ullong), per); } @@ -2985,7 +2985,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } @@ -2993,7 +2993,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong), per); } @@ -3003,7 +3003,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi else { if (temp1_ullong != temp2_ullong) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } @@ -3254,7 +3254,7 @@ void print_header(diff_opt_t *opts) *------------------------------------------------------------------------- */ static -void print_pos(diff_opt_t *opts, hsize_t idx, ssize_t u) +void print_pos(diff_opt_t *opts, hsize_t idx, size_t u) { int i,j; @@ -3317,7 +3317,7 @@ void print_pos(diff_opt_t *opts, hsize_t idx, ssize_t u) * Calculate the number of elements represented by a unit change in a * certain index position. */ - calc_acc_pos(opts->rank, curr_pos, opts->acc, opts->pos); + calc_acc_pos((unsigned)opts->rank, curr_pos, opts->acc, opts->pos); for (i = 0; i < opts->rank; i++) { H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld opts->sm_pos=%ld", i, opts->pos[i], opts->sm_pos[i]); @@ -3329,10 +3329,11 @@ void print_pos(diff_opt_t *opts, hsize_t idx, ssize_t u) parallel_print("]"); } else { - if (u >= 0) { + if (opts->print_dims) { parallel_print("[ "); parallel_print("%zu", u); parallel_print("]"); + opts->print_dims = 0; } else parallel_print(" "); |