summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-09-08 21:51:48 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-09-08 21:52:00 (GMT)
commit77313a1d39a4d08827df9c0186028b63c1ee1fd1 (patch)
tree75220ca8116c2636e87d28028c75da1ded266885 /tools
parent5f47a61ae93a973a53c2cfc925ccbc97ada7d30a (diff)
downloadhdf5-77313a1d39a4d08827df9c0186028b63c1ee1fd1.zip
hdf5-77313a1d39a4d08827df9c0186028b63c1ee1fd1.tar.gz
hdf5-77313a1d39a4d08827df9c0186028b63c1ee1fd1.tar.bz2
HDFFV-9774 Fix code merge
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff_array.c5812
1 files changed, 2230 insertions, 3582 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 7236ad1..68a9575 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -17,7 +17,6 @@
#include "h5diff.h"
#include "ph5diff.h"
-
/*-------------------------------------------------------------------------
* printf formatting
*-------------------------------------------------------------------------
@@ -66,9 +65,8 @@
#define LLI_FORMAT_P_NOTCOMP "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d not comparable\n"
#define ULLI_FORMAT_P_NOTCOMP "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "d not comparable\n"
-
/* if system EPSILON is defined, use the system EPSILON; otherwise, use
- constants that are close to most EPSILON values */
+ constants that are close to most EPSILON values */
#ifndef FLT_EPSILON
#define FLT_EPSILON 1.19209E-07
@@ -78,7 +76,6 @@
#define DBL_EPSILON 2.22045E-16
#endif
-
/*-------------------------------------------------------------------------
* -p relative error formula
*
@@ -108,7 +105,6 @@ static hbool_t not_comparable;
not_comparable = TRUE; \
}
-
#define PER_UNSIGN(TYPE,A,B) { \
per = -1; \
not_comparable = FALSE; \
@@ -121,210 +117,110 @@ static hbool_t not_comparable;
not_comparable = TRUE; \
}
-
#define PDIFF(a,b) (((b) > (a)) ? ((b) - (a)) : ((a) -(b)))
-typedef struct mcomp_t
-{
- unsigned n; /* number of members */
- hid_t *ids; /* member type id */
- size_t *offsets;
- struct mcomp_t **m; /* members */
-}mcomp_t;
-
+typedef struct mcomp_t {
+ unsigned n; /* number of members */
+ hid_t *ids; /* member type id */
+ size_t *offsets;
+ struct mcomp_t **m; /* members */
+} mcomp_t;
/*-------------------------------------------------------------------------
* local prototypes
*-------------------------------------------------------------------------
*/
-static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id,hid_t region1_id, hid_t region2_id, diff_opt_t *options);
+static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id,
+ hid_t region2_id, diff_opt_t *options);
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 i,size_t u,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph);
-static hsize_t character_compare_opt(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph);
+static int ull2float(unsigned long long ull_value, float *f_value);
+static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
+ int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
+ diff_opt_t *options, const char *obj1, const char *obj2, int *ph);
+static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
+ hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
+ diff_opt_t *options, const char *obj1, const char *obj2, int *ph);
static hbool_t equal_float(float value, float expected, diff_opt_t *options);
static hbool_t equal_double(double value, double expected, diff_opt_t *options);
#if H5_SIZEOF_LONG_DOUBLE !=0
static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options);
#endif
static int print_data(diff_opt_t *options);
-static void print_pos(int *ph,int pp,hsize_t curr_pos,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 );
-static void print_char_pos(int *ph,int pp,hsize_t curr_pos,size_t u,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 );
+static void print_pos(int *ph, int pp, hsize_t curr_pos, hsize_t *acc,
+ hsize_t *pos, int rank, hsize_t *dims, const char *obj1,
+ const char *obj2);
+static void print_char_pos(int *ph, int pp, hsize_t curr_pos, size_t u,
+ hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims, const char *obj1,
+ const char *obj2);
static void h5diff_print_char(char ch);
-static hsize_t diff_datum(void *_mem1,
- void *_mem2,
- hid_t m_type,
- hsize_t i,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- hid_t container1_id,
- hid_t container2_id, /*where the reference came from*/
- int *ph, /*print header */
- mcomp_t *members); /*compound members */
-static hsize_t diff_float(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_double(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+static hsize_t diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t index,
+ int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
+ diff_opt_t *options, const char *obj1, const char *obj2,
+ hid_t container1_id, hid_t container2_id, /*where the reference came from*/
+ int *ph, /*print header */
+ mcomp_t *members); /*compound members */
+static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
#if H5_SIZEOF_LONG_DOUBLE !=0
static hsize_t diff_ldouble(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
#endif
-static hsize_t diff_schar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_uchar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_short(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_ushort(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_int(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_uint(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_long(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_ulong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_llong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-static hsize_t diff_ullong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
+static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
+static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph);
/*-------------------------------------------------------------------------
* NaN detection
@@ -337,13 +233,11 @@ typedef enum dtype_t
FLT_FLOAT,
FLT_DOUBLE,
FLT_LDOUBLE
-} dtype_t;
+}dtype_t;
#else
-typedef enum dtype_t
-{
- FLT_FLOAT,
- FLT_DOUBLE
+typedef enum dtype_t {
+ FLT_FLOAT, FLT_DOUBLE
} dtype_t;
#endif
@@ -356,8 +250,6 @@ static hbool_t my_isnan(dtype_t type, void *val);
static void get_member_types(hid_t tid, mcomp_t *members);
static void close_member_types(mcomp_t *members);
-
-
/*-------------------------------------------------------------------------
* Function: diff_array
*
@@ -372,34 +264,35 @@ static void close_member_types(mcomp_t *members);
*-------------------------------------------------------------------------
*/
-hsize_t diff_array( void *_mem1,
- void *_mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- diff_opt_t *options,
- const char *name1,
- const char *name2,
- hid_t m_type,
- hid_t container1_id,
- hid_t container2_id) /* dataset where the reference came from*/
+hsize_t diff_array(
+ void *_mem1,
+ void *_mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ diff_opt_t *options,
+ const char *name1,
+ const char *name2,
+ hid_t m_type,
+ hid_t container1_id,
+ hid_t container2_id) /* dataset where the reference came from*/
{
- hsize_t nfound=0; /* number of differences found */
- size_t size; /* size of datum */
- unsigned char *mem1 = (unsigned char*)_mem1;
- unsigned char *mem2 = (unsigned char*)_mem2;
- hsize_t acc[32]; /* accumulator position */
- hsize_t pos[32]; /* matrix position */
- int ph=1; /* print header */
- hsize_t i;
- int j;
- mcomp_t members;
- H5T_class_t type_class;
+ hsize_t nfound = 0; /* number of differences found */
+ size_t size; /* size of datum */
+ unsigned char *mem1 = (unsigned char*) _mem1;
+ unsigned char *mem2 = (unsigned char*) _mem2;
+ hsize_t acc[32]; /* accumulator position */
+ hsize_t pos[32]; /* matrix position */
+ int ph = 1; /* print header */
+ hsize_t i;
+ int j;
+ mcomp_t members;
+ H5T_class_t type_class;
h5difftrace("diff_array start\n");
/* get the size. */
- size = H5Tget_size( m_type );
+ size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
/* Fast comparison first for atomic type by memcmp().
@@ -407,26 +300,22 @@ hsize_t diff_array( void *_mem1,
* by the condition, but it gives more clarity for code planning
*/
if (type_class != H5T_REFERENCE &&
- type_class != H5T_COMPOUND &&
- type_class != H5T_STRING &&
- type_class != H5T_VLEN &&
- HDmemcmp(mem1, mem2, size*nelmts)==0)
+ type_class != H5T_COMPOUND &&
+ type_class != H5T_STRING &&
+ type_class != H5T_VLEN &&
+ HDmemcmp(mem1, mem2, size*nelmts) == 0)
return 0;
- if ( rank > 0 )
- {
-
- acc[rank-1]=1;
- for(j=(rank-2); j>=0; j--)
- {
- acc[j]=acc[j+1]*dims[j+1];
+ if (rank > 0) {
+ acc[rank - 1] = 1;
+ for (j = (rank - 2); j >= 0; j--) {
+ acc[j] = acc[j + 1] * dims[j + 1];
}
- for ( j = 0; j < rank; j++)
- pos[j]=0;
+ for (j = 0; j < rank; j++)
+ pos[j] = 0;
}
- switch (type_class)
- {
+ switch (type_class) {
case H5T_NO_CLASS:
case H5T_TIME:
case H5T_NCLASSES:
@@ -434,52 +323,48 @@ hsize_t diff_array( void *_mem1,
HDassert(0);
break;
- /*-------------------------------------------------------------------------
- * float and integer atomic types
- *-------------------------------------------------------------------------
- */
-
+ /*-------------------------------------------------------------------------
+ * float and integer atomic types
+ *-------------------------------------------------------------------------
+ */
case H5T_FLOAT:
if (H5Tequal(m_type, H5T_NATIVE_FLOAT))
- nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_float(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
- nfound=diff_double(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+ nfound = diff_double(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+#if H5_SIZEOF_LONG_DOUBLE != 0
else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE))
- nfound=diff_ldouble(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_ldouble(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
#endif
break;
case H5T_INTEGER:
-
if (H5Tequal(m_type, H5T_NATIVE_SCHAR))
- nfound=diff_schar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_schar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_UCHAR))
- nfound=diff_uchar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_uchar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_SHORT))
- nfound=diff_short(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_short(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_USHORT))
- nfound=diff_ushort(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_ushort(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_INT))
- nfound=diff_int(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_int(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_UINT))
- nfound=diff_uint(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_uint(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_LONG))
- nfound=diff_long(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_long(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_ULONG))
- nfound=diff_ulong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_ulong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_LLONG))
- nfound=diff_llong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
+ nfound = diff_llong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_ULLONG))
- nfound=diff_ullong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
-
+ nfound = diff_ullong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
break;
/*-------------------------------------------------------------------------
* Other types than float and integer
*-------------------------------------------------------------------------
*/
-
case H5T_COMPOUND:
case H5T_STRING:
case H5T_BITFIELD:
@@ -488,27 +373,12 @@ hsize_t diff_array( void *_mem1,
case H5T_ARRAY:
case H5T_VLEN:
case H5T_REFERENCE:
- HDmemset(&members, 0, sizeof (mcomp_t));
+ HDmemset(&members, 0, sizeof(mcomp_t));
get_member_types(m_type, &members);
- for ( i = 0; i < nelmts; i++)
- {
- nfound+=diff_datum(
- mem1 + i * size,
- mem2 + i * size, /* offset */
- m_type,
- i,
- rank,
- dims,
- acc,
- pos,
- options,
- name1,
- name2,
- container1_id,
- container2_id,
- &ph, &members);
- if (options->n && nfound>=options->count)
- {
+ for (i = 0; i < nelmts; i++) {
+ nfound += diff_datum(mem1 + i * size, mem2 + i * size, m_type, i, rank, dims, acc, pos, options,
+ name1, name2, container1_id, container2_id, &ph, &members);
+ if (options->n && nfound >= options->count) {
close_member_types(&members);
return nfound;
}
@@ -557,45 +427,46 @@ hsize_t diff_array( void *_mem1,
* Dereference the object and compare the type (basic object type).
*-------------------------------------------------------------------------
*/
-static hsize_t diff_datum(void *_mem1,
- void *_mem2,
- hid_t m_type,
- hsize_t i,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- hid_t container1_id,
- hid_t container2_id, /*where the reference came from*/
- int *ph, /*print header */
- mcomp_t *members) /*compound members */
+static hsize_t diff_datum(
+ void *_mem1,
+ void *_mem2,
+ hid_t m_type,
+ hsize_t index,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ hid_t container1_id,
+ hid_t container2_id, /*where the reference came from*/
+ int *ph, /*print header */
+ mcomp_t *members) /*compound members */
{
- unsigned char *mem1 = (unsigned char*)_mem1;
- unsigned char *mem2 = (unsigned char*)_mem2;
- size_t u;
- hid_t memb_type;
- size_t type_size;
- H5T_sign_t type_sign;
- H5T_class_t type_class;
- size_t offset;
- unsigned nmembs;
- unsigned j;
- hsize_t nelmts;
- size_t size=0;
- hbool_t iszero1;
- hbool_t iszero2;
- hid_t obj1_id;
- hid_t obj2_id;
- hsize_t nfound=0; /* differences found */
- int ret=0; /* check return error */
- double per;
- hbool_t both_zero;
+ unsigned char *mem1 = (unsigned char*) _mem1;
+ unsigned char *mem2 = (unsigned char*) _mem2;
+ size_t u;
+ hid_t memb_type;
+ size_t type_size;
+ H5T_sign_t type_sign;
+ H5T_class_t type_class;
+ size_t offset;
+ unsigned nmembs;
+ unsigned j;
+ hsize_t nelmts;
+ size_t size = 0;
+ hbool_t iszero1;
+ hbool_t iszero2;
+ hid_t obj1_id;
+ hid_t obj2_id;
+ hsize_t nfound = 0; /* differences found */
+ int ret = 0; /* check return error */
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_datum start\n");
- type_size = H5Tget_size( m_type );
+ type_size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
/* Fast comparison first for atomic type by memcmp().
@@ -603,14 +474,13 @@ static hsize_t diff_datum(void *_mem1,
* by the condition, but it gives more clarity for code planning
*/
if (type_class != H5T_REFERENCE &&
- type_class != H5T_COMPOUND &&
- type_class != H5T_STRING &&
- type_class != H5T_VLEN &&
- HDmemcmp(mem1, mem2, type_size)==0)
+ type_class != H5T_COMPOUND &&
+ type_class != H5T_STRING &&
+ type_class != H5T_VLEN &&
+ HDmemcmp(mem1, mem2, type_size) == 0)
return 0;
- switch (H5Tget_class(m_type))
- {
+ switch (H5Tget_class(m_type)) {
case H5T_NO_CLASS:
case H5T_TIME:
case H5T_NCLASSES:
@@ -618,68 +488,53 @@ static hsize_t diff_datum(void *_mem1,
HDassert(0);
break;
- /*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
case H5T_COMPOUND:
h5difftrace("diff_datum H5T_COMPOUND\n");
nmembs = members->n;
-
- for (j = 0; j < nmembs; j++)
- {
- offset = members->offsets[j];
+ for (j = 0; j < nmembs; j++) {
+ offset = members->offsets[j];
memb_type = members->ids[j];
- nfound+=diff_datum(
- mem1 + offset,
- mem2 + offset,
- memb_type,
- i,
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- container1_id,
- container2_id,
- ph, members->m[j]);
+ nfound += diff_datum(mem1 + offset, mem2 + offset, memb_type, index,
+ rank, dims, acc, pos, options, obj1, obj2, container1_id, container2_id, ph, members->m[j]);
}
break;
- /*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
case H5T_STRING:
h5difftrace("diff_datum H5T_STRING\n");
{
- char *s = NULL;
- char *sx = NULL;
- char *s1 = NULL;
- char *s2 = NULL;
- size_t size1;
- size_t size2;
- size_t sizex;
- size_t size_mtype = H5Tget_size(m_type);
- H5T_str_t pad = H5Tget_strpad(m_type);
+ char *s = NULL;
+ char *sx = NULL;
+ char *s1 = NULL;
+ char *s2 = NULL;
+ size_t size1;
+ size_t size2;
+ size_t sizex;
+ size_t size_mtype = H5Tget_size(m_type);
+ H5T_str_t pad = H5Tget_strpad(m_type);
/* if variable length string */
- if(H5Tis_variable_str(m_type)) {
+ if (H5Tis_variable_str(m_type)) {
h5difftrace("diff_datum H5T_STRING variable\n");
/* Get pointer to first string */
s1 = *(char**) mem1;
- if(s1)
+ if (s1)
size1 = HDstrlen(s1);
else
size1 = 0;
/* Get pointer to second string */
s2 = *(char**) mem2;
- if(s2)
+ if (s2)
size2 = HDstrlen(s2);
else
size2 = 0;
@@ -688,7 +543,7 @@ static hsize_t diff_datum(void *_mem1,
h5difftrace("diff_datum H5T_STRING null term\n");
/* Get pointer to first string */
s1 = (char*) mem1;
- if(s1)
+ if (s1)
size1 = HDstrlen(s1);
else
size1 = 0;
@@ -696,7 +551,7 @@ static hsize_t diff_datum(void *_mem1,
size1 = size_mtype;
/* Get pointer to second string */
s2 = (char*) mem2;
- if(s2)
+ if (s2)
size2 = HDstrlen(s2);
else
size2 = 0;
@@ -705,10 +560,10 @@ static hsize_t diff_datum(void *_mem1,
}
else {
/* Get pointer to first string */
- s1 = (char *)mem1;
+ s1 = (char *) mem1;
size1 = size_mtype;
/* Get pointer to second string */
- s2 = (char *)mem2;
+ s2 = (char *) mem2;
size2 = size_mtype;
}
@@ -720,11 +575,11 @@ static hsize_t diff_datum(void *_mem1,
*/
h5diffdebug2("diff_datum string size:%d\n",size1);
h5diffdebug2("diff_datum string size:%d\n",size2);
- if(size1 != size2) {
+ if (size1 != size2) {
h5difftrace("diff_datum string sizes\n");
nfound++;
}
- if(size1 < size2) {
+ if (size1 < size2) {
size = size1;
s = s1;
sizex = size2;
@@ -738,68 +593,30 @@ static hsize_t diff_datum(void *_mem1,
}
/* check for NULL pointer for string */
- if(s!=NULL) {
+ if (s != NULL) {
/* try fast compare first */
- if(HDmemcmp(s1, s2, size)==0) {
- if(size1 != size2)
- if(print_data(options))
- for (u=size; u<sizex; u++)
- character_compare(
- s1 + u,
- s2 + u, /* offset */
- i, /* index position */
- u, /* string character position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
+ if (HDmemcmp(s1, s2, size) == 0) {
+ if (size1 != size2)
+ if (print_data(options))
+ for (u = size; u < sizex; u++)
+ character_compare(s1 + u, s2 + u, index, u, rank, dims, acc, pos, options, obj1, obj2, ph);
}
else
- for (u=0; u<size; u++)
- nfound+=character_compare(
- s1 + u,
- s2 + u, /* offset */
- i, /* index position */
- u, /* string character position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
- }
-
+ for (u = 0; u < size; u++)
+ nfound += character_compare(s1 + u, s2 + u, index, u, rank, dims, acc, pos, options, obj1, obj2, ph);
+ } /* end check for NULL pointer for string */
}
break;
- /*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
case H5T_BITFIELD:
h5difftrace("diff_datum H5T_BITFIELD\n");
-
/* byte-by-byte comparison */
- for (u=0; u<type_size; u++)
- nfound+=character_compare_opt(
- mem1 + u,
- mem2 + u, /* offset */
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
-
+ for (u = 0; u < type_size; u++)
+ nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, options, obj1, obj2, ph);
break;
/*-------------------------------------------------------------------------
@@ -809,1754 +626,1294 @@ static hsize_t diff_datum(void *_mem1,
case H5T_OPAQUE:
h5difftrace("diff_datum H5T_OPAQUE\n");
/* byte-by-byte comparison */
- for (u=0; u<type_size; u++)
- nfound+=character_compare_opt(
- mem1 + u,
- mem2 + u, /* offset */
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
-
+ for (u = 0; u < type_size; u++)
+ nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, options, obj1, obj2, ph);
break;
-
- /*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
case H5T_ENUM:
- h5difftrace("diff_datum H5T_ENUM\n");
-
- /* For enumeration types we compare the names instead of the
- integer values. For each pair of elements being
- compared, we convert both bit patterns to their corresponding
- enumeration constant and do a string comparison
- */
-
+ /* For enumeration types we compare the names instead of the
+ * integer values. For each pair of elements being
+ * compared, we convert both bit patterns to their corresponding
+ * enumeration constant and do a string comparison
+ */
{
+ h5difftrace("diff_datum H5T_ENUM\n");
char enum_name1[1024];
char enum_name2[1024];
-
herr_t err1;
herr_t err2;
/* disable error reporting */
H5E_BEGIN_TRY {
-
/* If the enum value cannot be converted to a string
* it is set to an error string for later output.
*/
err1 = H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1);
- if(err1 < 0)
+ if (err1 < 0)
HDsnprintf(enum_name1, sizeof(enum_name1), "**INVALID VALUE**");
err2 = H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2);
- if(err2 < 0)
+ if (err2 < 0)
HDsnprintf(enum_name2, sizeof(enum_name2), "**INVALID VALUE**");
- if(err1 < 0 || err2 < 0)
- {
- /* One or more bad enum values */
-
+ /* One or more bad enum values */
+ if (err1 < 0 || err2 < 0) {
/* If the two values cannot be converted to a string
* (probably due to them being invalid enum values),
* don't attempt to convert them - just report errors.
*/
nfound += 1;
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(S_FORMAT,enum_name1,enum_name2);
+ parallel_print(S_FORMAT, enum_name1, enum_name2);
}
}
- else
- {
+ else {
/* Both enum values were valid */
-
- if (HDstrcmp(enum_name1,enum_name2)!=0)
- {
- nfound=1;
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (HDstrcmp(enum_name1, enum_name2) != 0) {
+ nfound = 1;
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(S_FORMAT,enum_name1,enum_name2);
+ parallel_print(S_FORMAT, enum_name1, enum_name2);
}
}
- else
- {
- for (u=0; u<type_size; u++)
- nfound+=character_compare_opt(
- mem1 + u,
- mem2 + u, /* offset */
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
+ else {
+ for (u = 0; u < type_size; u++)
+ nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, options, obj1, obj2, ph);
}
}
/* enable error reporting */
} H5E_END_TRY;
}
-
-
break;
- /*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
case H5T_ARRAY:
-
{
hsize_t adims[H5S_MAX_RANK];
- int ndims;
+ int ndims;
/* get the array's base datatype for each element */
memb_type = H5Tget_super(m_type);
- size = H5Tget_size(memb_type);
- ndims = H5Tget_array_ndims(m_type);
+ size = H5Tget_size(memb_type);
+ ndims = H5Tget_array_ndims(m_type);
H5Tget_array_dims2(m_type, adims);
HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
/* calculate the number of array elements */
- for (u = 0, nelmts = 1; u < (unsigned)ndims; u++)
+ for (u = 0, nelmts = 1; u < (unsigned) ndims; u++)
nelmts *= adims[u];
for (u = 0; u < nelmts; u++) {
- nfound += diff_datum(
- mem1 + u * size,
- mem2 + u * size, /* offset */
- memb_type,
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- container1_id,
- container2_id,
- ph, members);
+ nfound += diff_datum(mem1 + u * size, mem2 + u * size, memb_type, index,
+ rank, dims, acc, pos, options, obj1, obj2, container1_id, container2_id, ph, members);
}
H5Tclose(memb_type);
}
break;
-
-
- /*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
-
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
case H5T_REFERENCE:
-
- iszero1=all_zero(_mem1, H5Tget_size(m_type));
- iszero2=all_zero(_mem2, H5Tget_size(m_type));
- if (iszero1 != iszero2)
- {
+ iszero1 = all_zero(_mem1, H5Tget_size(m_type));
+ iszero2 = all_zero(_mem2, H5Tget_size(m_type));
+ if (iszero1 != iszero2) {
return 1;
}
- else if (!iszero1 && !iszero2)
- {
+ else if (!iszero1 && !iszero2) {
+ /*-------------------------------------------------------------------------
+ * H5T_STD_REF_DSETREG
+ * Dataset region reference
+ *-------------------------------------------------------------------------
+ */
+ if (type_size == H5R_DSET_REG_REF_BUF_SIZE) {
+ hid_t region1_id;
+ hid_t region2_id;
- /*-------------------------------------------------------------------------
- * H5T_STD_REF_DSETREG
- * Dataset region reference
- *-------------------------------------------------------------------------
- */
- if (type_size==H5R_DSET_REG_REF_BUF_SIZE)
- {
- hid_t region1_id;
- hid_t region2_id;
-
- if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1))<0)
- ret= -1;
- if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2))<0)
- ret= -1;
- if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1))<0)
- ret= -1;
- if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2))<0)
- ret= -1;
-
- if (ret==-1) {
- options->err_stat=1;
+ if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0)
+ ret = -1;
+ if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0)
+ ret = -1;
+ if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0)
+ ret = -1;
+ if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0)
+ ret = -1;
+
+ if (ret == -1) {
+ options->err_stat = 1;
return 0;
}
- nfound = diff_region(obj1_id,obj2_id,region1_id,region2_id,options);
-
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, options);
H5Oclose(obj1_id);
H5Oclose(obj2_id);
H5Sclose(region1_id);
H5Sclose(region2_id);
-
}/*dataset reference*/
+ /*-------------------------------------------------------------------------
+ * H5T_STD_REF_OBJ
+ * Object references. get the type and OID of the referenced object
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == H5R_OBJ_REF_BUF_SIZE) {
+ H5O_type_t obj1_type;
+ H5O_type_t obj2_type;
- /*-------------------------------------------------------------------------
- * H5T_STD_REF_OBJ
- * Object references. get the type and OID of the referenced object
- *-------------------------------------------------------------------------
- */
- else if (type_size == H5R_OBJ_REF_BUF_SIZE)
- {
- H5O_type_t obj1_type;
- H5O_type_t obj2_type;
-
- if(H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0)
+ if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0)
ret = -1;
- if(H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0)
+ if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0)
ret = -1;
- if(ret == -1) {
+ if (ret == -1) {
options->err_stat = 1;
return 0;
} /* end if */
/* check object type */
- if(obj1_type != obj2_type)
- {
- parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
+ if (obj1_type != obj2_type) {
+ parallel_print(
+ "Different object types referenced: <%s> and <%s>", obj1, obj2);
options->not_cmp = 1;
return 0;
}
- if((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0)
+ if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0)
ret = -1;
- if((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0)
+ if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0)
ret = -1;
- if(ret == -1) {
+ if (ret == -1) {
options->err_stat = 1;
return 0;
- } /* end if */
+ }
/* compare */
- if(obj1_type == H5O_TYPE_DATASET)
- nfound = diff_datasetid(obj1_id,
- obj2_id,
- NULL,
- NULL,
- options);
+ if (obj1_type == H5O_TYPE_DATASET)
+ nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, options);
else {
- if(options->m_verbose)
- parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n",
- obj1, obj2);
+ if (options->m_verbose)
+ parallel_print(
+ "Warning: Comparison not possible of object types referenced: <%s> and <%s>\n",
+ obj1, obj2);
options->not_cmp = 1;
}
H5Oclose(obj1_id);
H5Oclose(obj2_id);
-
}/*object reference*/
-
}/*is zero*/
-
-
break;
- /*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
-
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
case H5T_VLEN:
-
/* get the VL sequences's base datatype for each element */
memb_type = H5Tget_super(m_type);
- size = H5Tget_size(memb_type);
+ size = H5Tget_size(memb_type);
/* get the number of sequence elements */
- nelmts = ((hvl_t *)mem1)->len;
+ nelmts = ((hvl_t *) mem1)->len;
for (j = 0; j < nelmts; j++)
- nfound += diff_datum(
- ((char *)(((hvl_t *)mem1)->p)) + j * size,
- ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */
- memb_type,
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- container1_id,
- container2_id,
- ph, members);
+ nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index,
+ rank, dims, acc, pos, options, obj1, obj2, container1_id, container2_id, ph, members);
H5Tclose(memb_type);
-
break;
-
-
- /*-------------------------------------------------------------------------
- * H5T_INTEGER
- *-------------------------------------------------------------------------
- */
-
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER
+ *-------------------------------------------------------------------------
+ */
case H5T_INTEGER:
type_sign = H5Tget_sign(m_type);
-
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_SCHAR
- *-------------------------------------------------------------------------
- */
- if (type_size==1 && type_sign!=H5T_SGN_NONE)
- {
- char temp1_char;
- char temp2_char;
- HDassert(type_size==sizeof(char));
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_SCHAR
+ *-------------------------------------------------------------------------
+ */
+ if (type_size == 1 && type_sign != H5T_SGN_NONE) {
+ char temp1_char;
+ char temp2_char;
+ HDassert(type_size == sizeof(char));
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
/* -d and !-p */
- if (options->d && !options->p)
- {
- if (ABS(temp1_char-temp2_char) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (ABS(temp1_char-temp2_char) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER(temp1_char,temp2_char);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (!options->d && options->p) {
+ PER(temp1_char, temp2_char);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_char,temp2_char,ABS(temp1_char-temp2_char),per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER(temp1_char,temp2_char);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (options->d && options->p) {
+ PER(temp1_char, temp2_char);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_char,temp2_char,ABS(temp1_char-temp2_char),per);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_char - temp2_char) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
}
+ nfound++;
+ }
}
- else if (temp1_char != temp2_char)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_char != temp2_char) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
-
} /*H5T_NATIVE_SCHAR*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_UCHAR
- *-------------------------------------------------------------------------
- */
- else if (type_size==1 && type_sign==H5T_SGN_NONE)
- {
- unsigned char temp1_uchar;
- unsigned char temp2_uchar;
- HDassert(type_size==sizeof(unsigned char));
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_UCHAR
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 1 && type_sign == H5T_SGN_NONE) {
+ unsigned char temp1_uchar;
+ unsigned char temp2_uchar;
+ HDassert(type_size == sizeof(unsigned char));
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
/* -d and !-p */
- if (options->d && !options->p)
- {
- if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (PDIFF(temp1_uchar, temp2_uchar) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (!options->d && options->p) {
+ PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (options->d && options->p) {
+ PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per);
- }
- nfound++;
+ else if (per > options->percent && PDIFF(temp1_uchar, temp2_uchar) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
+ nfound++;
+ }
}
- else if (temp1_uchar != temp2_uchar)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_uchar != temp2_uchar) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
-
} /*H5T_NATIVE_UCHAR*/
-
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_SHORT
- *-------------------------------------------------------------------------
- */
-
- else if (type_size==2 && type_sign!=H5T_SGN_NONE)
- {
- short temp1_short;
- short temp2_short;
- HDassert(type_size==sizeof(short));
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_SHORT
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 2 && type_sign != H5T_SGN_NONE) {
+ short temp1_short;
+ short temp2_short;
+ HDassert(type_size == sizeof(short));
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
/* -d and !-p */
- if (options->d && !options->p)
- {
- if (ABS(temp1_short-temp2_short) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (ABS(temp1_short - temp2_short) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER(temp1_short,temp2_short);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (!options->d && options->p) {
+ PER(temp1_short, temp2_short);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_short,temp2_short,ABS(temp1_short-temp2_short),per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER(temp1_short,temp2_short);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (options->d && options->p) {
+ PER(temp1_short, temp2_short);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_short,temp2_short,ABS(temp1_short-temp2_short),per);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_short - temp2_short) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
}
+ nfound++;
+ }
}
- else if (temp1_short != temp2_short)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_short != temp2_short) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
-
-
} /*H5T_NATIVE_SHORT*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_USHORT
- *-------------------------------------------------------------------------
- */
-
- else if (type_size==2 && type_sign==H5T_SGN_NONE)
- {
- unsigned short temp1_ushort;
- unsigned short temp2_ushort;
- HDassert(type_size==sizeof(short));
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_USHORT
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 2 && type_sign == H5T_SGN_NONE) {
+ unsigned short temp1_ushort;
+ unsigned short temp2_ushort;
+ HDassert(type_size == sizeof(short));
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
/* -d and !-p */
- if (options->d && !options->p)
- {
- if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta)
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (PDIFF(temp1_ushort, temp2_ushort) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (!options->d && options->p) {
+ PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,
- PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort),per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (options->d && options->p) {
+ PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort),per);
- }
- nfound++;
+ else if (per > options->percent && PDIFF(temp1_ushort, temp2_ushort) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
}
+ nfound++;
+ }
}
- else if (temp1_ushort != temp2_ushort)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_ushort != temp2_ushort) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
} /*H5T_NATIVE_USHORT*/
-
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_INT
- *-------------------------------------------------------------------------
- */
-
- else if (type_size==4 && type_sign!=H5T_SGN_NONE)
- {
- int temp1_int;
- int temp2_int;
- HDassert(type_size==sizeof(int));
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 4 && type_sign != H5T_SGN_NONE) {
+ int temp1_int;
+ int temp2_int;
+ HDassert(type_size == sizeof(int));
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
/* -d and !-p */
- if (options->d && !options->p)
- {
- if (ABS(temp1_int-temp2_int) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (ABS(temp1_int-temp2_int) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
+ parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER(temp1_int,temp2_int);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (!options->d && options->p) {
+ PER(temp1_int, temp2_int);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_int,temp2_int,ABS(temp1_int-temp2_int),per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER(temp1_int,temp2_int);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (options->d && options->p) {
+ PER(temp1_int, temp2_int);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_int,temp2_int,ABS(temp1_int-temp2_int),per);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_int - temp2_int) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
}
+ nfound++;
+ }
}
- else if (temp1_int != temp2_int)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_int != temp2_int) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
+ parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
} /*H5T_NATIVE_INT*/
-
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_UINT
- *-------------------------------------------------------------------------
- */
-
- else if (type_size==4 && type_sign==H5T_SGN_NONE)
- {
- unsigned int temp1_uint;
- unsigned int temp2_uint;
- HDassert(type_size==sizeof(int));
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_UINT
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 4 && type_sign == H5T_SGN_NONE) {
+ unsigned int temp1_uint;
+ unsigned int temp2_uint;
+ HDassert(type_size == sizeof(int));
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
/* -d and !-p */
- if (options->d && !options->p)
- {
- if ( PDIFF(temp1_uint,temp2_uint) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (PDIFF(temp1_uint, temp2_uint) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(UI_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER_UNSIGN(signed int,temp1_uint,temp2_uint);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (!options->d && options->p) {
+ PER_UNSIGN(signed int, temp1_uint, temp2_uint);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(UI_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(UI_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER_UNSIGN(signed int,temp1_uint,temp2_uint);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (options->d && options->p) {
+ PER_UNSIGN(signed int, temp1_uint, temp2_uint);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(UI_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(UI_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per);
- }
- nfound++;
+ else if (per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
}
+ nfound++;
+ }
}
- else if (temp1_uint != temp2_uint)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_uint != temp2_uint) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(UI_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
} /*H5T_NATIVE_UINT*/
-
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_LONG
- *-------------------------------------------------------------------------
- */
-
- else if (type_size==8 && type_sign!=H5T_SGN_NONE)
- {
- long temp1_long;
- long temp2_long;
- HDassert(type_size==sizeof(long));
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LONG
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 8 && type_sign != H5T_SGN_NONE) {
+ long temp1_long;
+ long temp2_long;
+ HDassert(type_size == sizeof(long));
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
/* -d and !-p */
- if (options->d && !options->p)
- {
- if (ABS(temp1_long-temp2_long) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (ABS(temp1_long-temp2_long) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long));
+ parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER(temp1_long,temp2_long);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (!options->d && options->p) {
+ PER(temp1_long, temp2_long);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long));
+ parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_long,temp2_long,ABS(temp1_long-temp2_long),per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER(temp1_long,temp2_long);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (options->d && options->p) {
+ PER(temp1_long, temp2_long);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,ABS(temp1_long-temp2_long));
+ parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long),
- per);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_long-temp2_long) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
}
+ nfound++;
+ }
}
- else if (temp1_long != temp2_long)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_long != temp2_long) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long));
+ parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
} /*H5T_NATIVE_LONG*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_ULONG
- *-------------------------------------------------------------------------
- */
-
- else if (type_size==8 && type_sign==H5T_SGN_NONE)
- {
- unsigned long temp1_ulong;
- unsigned long temp2_ulong;
- HDassert(type_size==sizeof(unsigned long));
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_ULONG
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 8 && type_sign == H5T_SGN_NONE) {
+ unsigned long temp1_ulong;
+ unsigned long temp2_ulong;
+ HDassert(type_size == sizeof(unsigned long));
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
/* -d and !-p */
- if (options->d && !options->p)
- {
- if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (PDIFF(temp1_ulong, temp2_ulong) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(ULI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER_UNSIGN(signed long,temp1_ulong,temp2_ulong);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (!options->d && options->p) {
+ PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong),per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER_UNSIGN(signed long,temp1_ulong,temp2_ulong);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (options->d && options->p) {
+ PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
+
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong),per);
- }
- nfound++;
+ else if (per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
}
+ nfound++;
+ }
}
- else if (temp1_ulong != temp2_ulong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_ulong != temp2_ulong) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(ULI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
-
-
} /*H5T_NATIVE_ULONG*/
-
break; /* H5T_INTEGER class */
-
- /*-------------------------------------------------------------------------
- * H5T_FLOAT
- *-------------------------------------------------------------------------
- */
-
+ /*-------------------------------------------------------------------------
+ * H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
case H5T_FLOAT:
-
-
-
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_FLOAT
- *-------------------------------------------------------------------------
- */
- if (type_size==4)
- {
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ if (type_size == 4) {
float temp1_float;
float temp2_float;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
- HDassert(type_size==sizeof(float));
+ HDassert(type_size == sizeof(float));
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
/* logic for detecting NaNs is different with options -d, -p and no options */
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
- if (options->d && !options->p)
- {
-
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_FLOAT,&temp1_float);
- isnan2 = my_isnan(FLT_FLOAT,&temp2_float);
+ /*-------------------------------------------------------------------------
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
+ if (options->d && !options->p) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
+ isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
- /* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
-
- if (ABS(temp1_float-temp2_float) > (float)options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ if (ABS(temp1_float-temp2_float) > (float) options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,(double)temp1_float,(double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
-
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
-
}
}
- /*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!options->d && options->p)
- {
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_FLOAT,&temp1_float);
- isnan2 = my_isnan(FLT_FLOAT,&temp2_float);
+ /*-------------------------------------------------------------------------
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (!options->d && options->p) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
+ isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
+ if (!isnan1 && !isnan2) {
+ PER(temp1_float, temp2_float);
- PER(temp1_float,temp2_float);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && (double)ABS(temp1_float-temp2_float) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
- (double)ABS(temp1_float - temp2_float),
- (double)ABS(1 - temp2_float / temp1_float));
- }
- nfound++;
+ else if (per > options->percent && (double) ABS(temp1_float - temp2_float) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1,
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
+ (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
}
-
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
-
}
}
-
- /*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
-
- else if ( options->d && options->p)
- {
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_FLOAT,&temp1_float);
- isnan2 = my_isnan(FLT_FLOAT,&temp2_float);
+ /*-------------------------------------------------------------------------
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (options->d && options->p) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
+ isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
- /* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
-
- PER(temp1_float,temp2_float);
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ PER(temp1_float, temp2_float);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float,
- (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
- (double)ABS(temp1_float - temp2_float),
- (double)ABS(1 - temp2_float / temp1_float));
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
+ (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
}
-
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
-
}
}
-
- /*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
- else if (equal_float(temp1_float,temp2_float,options)==FALSE)
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ /*-------------------------------------------------------------------------
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (equal_float(temp1_float, temp2_float, options) == FALSE) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
} /*H5T_NATIVE_FLOAT*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_DOUBLE
- *-------------------------------------------------------------------------
- */
-
- else if (type_size==8)
- {
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 8) {
double temp1_double;
double temp2_double;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
- HDassert(type_size==sizeof(double));
+ HDassert(type_size == sizeof(double));
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
- /* logic for detecting NaNs is different with options -d, -p and no options */
-
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
- if (options->d && !options->p)
- {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_DOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
+ /* logic for detecting NaNs is different with options -d, -p and no options */
+ /*-------------------------------------------------------------------------
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
+ if (options->d && !options->p) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
-
- if (ABS(temp1_double-temp2_double) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (!isnan1 && !isnan2) {
+ if (ABS(temp1_double-temp2_double) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
-
}
} /* options->d && !options->p */
-
- /*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!options->d && options->p)
- {
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_DOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
+ /*-------------------------------------------------------------------------
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (!options->d && options->p) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double, temp2_double);
- PER(temp1_double,temp2_double);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
-
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
-
}
}
-
- /*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if ( options->d && options->p)
- {
-
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (options->d && options->p) {
+ /*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_DOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
-
- PER(temp1_double,temp2_double);
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double, temp2_double);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
- else
-
- if ( per > options->percent &&
- ABS(temp1_double-temp2_double) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
- }
- nfound++;
+ else if (per > options->percent &&
+ ABS(temp1_double-temp2_double) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
-
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
}
-
- /*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
- else if (equal_double(temp1_double,temp2_double,options)==FALSE)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ /*-------------------------------------------------------------------------
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (equal_double(temp1_double, temp2_double, options) == FALSE) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- } /*H5T_NATIVE_DOUBLE*/
+ } /*H5T_NATIVE_DOUBLE*/
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
-
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_LDOUBLE
- *-------------------------------------------------------------------------
- */
-
- else if (type_size == H5_SIZEOF_LONG_DOUBLE)
- {
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LDOUBLE
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == H5_SIZEOF_LONG_DOUBLE) {
long double temp1_double;
long double temp2_double;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
-
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
HDassert(type_size == sizeof(long double));
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
- /* logic for detecting NaNs is different with options -d, -p and no options */
-
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
- if (options->d && !options->p)
- {
+ /* logic for detecting NaNs is different with options -d, -p and no options */
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
+ /*-------------------------------------------------------------------------
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
+ if (options->d && !options->p) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
}
- /* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
-
- if (ABS(temp1_double-temp2_double) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ if (ABS(temp1_double-temp2_double) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LD_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
} /* NaN */
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
}
-
- /*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!options->d && options->p)
- {
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
+ /*-------------------------------------------------------------------------
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (!options->d && options->p) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
- /* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
-
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
PER(temp1_double,temp2_double);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
+ parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LD_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
-
+ nfound++;
+ }
} /* NaN */
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- }
-
- /*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if ( options->d && options->p)
- {
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
+ }
+ /*-------------------------------------------------------------------------
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if ( options->d && options->p) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
- /* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
-
+ /* both not NaN, do the comparison */
+ if ( !isnan1 && !isnan2) {
PER(temp1_double,temp2_double);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
+ parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
- else
-
- if ( per > options->percent &&
- ABS(temp1_double-temp2_double) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LD_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_double-temp2_double) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
-
+ nfound++;
+ }
} /* NaN */
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
}
-
- /*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
- else if (equal_ldouble(temp1_double,temp2_double,options)==FALSE)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ /*-------------------------------------------------------------------------
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (equal_ldouble(temp1_double, temp2_double, options) == FALSE) {
+ if (print_data(options)) {
+ print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LD_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- } /*H5T_NATIVE_LDOUBLE*/
+ } /*H5T_NATIVE_LDOUBLE*/
#endif /* H5_SIZEOF_LONG_DOUBLE */
+ break; /* H5T_FLOAT class */
-
- break; /* H5T_FLOAT class */
-
- } /* switch */
+ } /* switch */
h5difftrace("diff_datum finish\n");
- return nfound;
+ return nfound;
}
/*-------------------------------------------------------------------------
@@ -2569,12 +1926,11 @@ static hsize_t diff_datum(void *_mem1,
*-------------------------------------------------------------------------
*/
-static hbool_t all_zero(const void *_mem, size_t size)
-{
- const unsigned char *mem = (const unsigned char *)_mem;
+static hbool_t all_zero(const void *_mem, size_t size) {
+ const unsigned char *mem = (const unsigned char *) _mem;
- while(size-- > 0)
- if(mem[size])
+ while (size-- > 0)
+ if (mem[size])
return FALSE;
return TRUE;
@@ -2591,22 +1947,18 @@ static hbool_t all_zero(const void *_mem, size_t size)
*/
static
-void print_region_block(int i, hsize_t *ptdata, int ndims)
-{
+void print_region_block(int i, hsize_t *ptdata, int ndims) {
int j;
parallel_print(" ");
for (j = 0; j < ndims; j++)
- parallel_print("%s%lu", j ? "," : " (",
- (unsigned long)ptdata[i * 2 * ndims + j]);
+ parallel_print("%s%lu", j ? "," : " (", (unsigned long) ptdata[i * 2 * ndims + j]);
for (j = 0; j < ndims; j++)
- parallel_print("%s%lu", j ? "," : ")-(",
- (unsigned long)ptdata[i * 2 * ndims + j + ndims]);
+ parallel_print("%s%lu", j ? "," : ")-(", (unsigned long) ptdata[i * 2 * ndims + j + ndims]);
parallel_print(")");
}
-
/*-------------------------------------------------------------------------
* Function: print_points
*
@@ -2618,14 +1970,12 @@ void print_region_block(int i, hsize_t *ptdata, int ndims)
*/
static
-void print_points(int i, hsize_t *ptdata, int ndims)
-{
+void print_points(int i, hsize_t *ptdata, int ndims) {
int j;
parallel_print(" ");
for (j = 0; j < ndims; j++)
- parallel_print("%s%lu", j ? "," : "(",
- (unsigned long)(ptdata[i * ndims + j]));
+ parallel_print("%s%lu", j ? "," : "(", (unsigned long) (ptdata[i * ndims + j]));
parallel_print(")");
}
@@ -2640,62 +1990,61 @@ void print_points(int i, hsize_t *ptdata, int ndims)
*-------------------------------------------------------------------------
*/
-static
-hsize_t diff_region(hid_t obj1_id,
- hid_t obj2_id,
- hid_t region1_id,
- hid_t region2_id,
- diff_opt_t *options)
+static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *options)
{
- hssize_t nblocks1, npoints1;
- hssize_t nblocks2, npoints2;
- hsize_t alloc_size;
- hsize_t *ptdata1;
- hsize_t *ptdata2;
- int ndims1;
- int ndims2;
- int i, j;
- hsize_t nfound_b = 0; /* block differences found */
- hsize_t nfound_p = 0; /* point differences found */
+ hssize_t nblocks1, npoints1;
+ hssize_t nblocks2, npoints2;
+ hsize_t alloc_size;
+ hsize_t *ptdata1;
+ hsize_t *ptdata2;
+ int ndims1;
+ int ndims2;
+ int i, j;
+ hsize_t nfound_b = 0; /* block differences found */
+ hsize_t nfound_p = 0; /* point differences found */
ndims1 = H5Sget_simple_extent_ndims(region1_id);
ndims2 = H5Sget_simple_extent_ndims(region2_id);
/*
- * These two functions fail if the region does not have blocks or points,
- * respectively. They do not currently know how to translate from one to
- * the other.
- */
- H5E_BEGIN_TRY {
- nblocks1 = H5Sget_select_hyper_nblocks(region1_id);
- nblocks2 = H5Sget_select_hyper_nblocks(region2_id);
+ * These two functions fail if the region does not have blocks or points,
+ * respectively. They do not currently know how to translate from one to
+ * the other.
+ */
+ H5E_BEGIN_TRY
+ {
+ nblocks1 = H5Sget_select_hyper_nblocks(region1_id);
+ nblocks2 = H5Sget_select_hyper_nblocks(region2_id);
- npoints1 = H5Sget_select_elem_npoints(region1_id);
- npoints2 = H5Sget_select_elem_npoints(region2_id);
- } H5E_END_TRY;
+ npoints1 = H5Sget_select_elem_npoints(region1_id);
+ npoints2 = H5Sget_select_elem_npoints(region2_id);
+ }H5E_END_TRY;
- if(nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) {
+ if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) {
options->not_cmp = 1;
return 0;
}
/*-------------------------------------------------------------------------
- * compare block information
- *-------------------------------------------------------------------------
- */
- if(nblocks1 > 0) {
+ * compare block information
+ *-------------------------------------------------------------------------
+ */
+ if (nblocks1 > 0) {
HDassert(ndims1 > 0);
- alloc_size = (hsize_t)nblocks1 * (unsigned)ndims1 * 2 * sizeof(ptdata1[0]);
- HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
+ alloc_size = (hsize_t) nblocks1 * (unsigned) ndims1 * 2
+ * sizeof(ptdata1[0]);
+ HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
- ptdata1 = (hsize_t *)HDmalloc((size_t)alloc_size);
+ ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size);
H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region1_id, (hsize_t)0, (hsize_t)nblocks1, ptdata1);
+ H5Sget_select_hyper_blocklist(region1_id, (hsize_t) 0,
+ (hsize_t) nblocks1, ptdata1);
- ptdata2 = (hsize_t *)HDmalloc((size_t)alloc_size);
+ ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size);
H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region2_id, (hsize_t)0, (hsize_t)nblocks2, ptdata2);
+ H5Sget_select_hyper_blocklist(region2_id, (hsize_t) 0,
+ (hsize_t) nblocks2, ptdata2);
for (i = 0; i < nblocks1; i++) {
/* start coordinates and opposite corner */
@@ -2704,14 +2053,13 @@ hsize_t diff_region(hid_t obj1_id,
start1 = ptdata1[i * 2 * ndims1 + j];
start2 = ptdata2[i * 2 * ndims1 + j];
- end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
- end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
+ end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
+ end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
if (start1 != start2 || end1 != end2)
nfound_b++;
}
}
-
/* print differences if found */
if (nfound_b && options->m_verbose) {
H5O_info_t oi1, oi2;
@@ -2720,8 +2068,9 @@ hsize_t diff_region(hid_t obj1_id,
H5Oget_info(obj2_id, &oi2);
parallel_print("Referenced dataset %lu %lu\n",
- (unsigned long)oi1.addr, (unsigned long)oi2.addr);
- parallel_print("------------------------------------------------------------\n");
+ (unsigned long) oi1.addr, (unsigned long) oi2.addr);
+ parallel_print(
+ "------------------------------------------------------------\n");
parallel_print("Region blocks\n");
for (i = 0; i < nblocks1; i++) {
@@ -2737,47 +2086,50 @@ hsize_t diff_region(hid_t obj1_id,
}
/*-------------------------------------------------------------------------
- * compare point information
- *-------------------------------------------------------------------------
- */
- if(npoints1 > 0) {
- alloc_size = (hsize_t)npoints1 * (unsigned)ndims1 * sizeof(ptdata1[0]);
- HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
+ * compare point information
+ *-------------------------------------------------------------------------
+ */
+ if (npoints1 > 0) {
+ alloc_size = (hsize_t) npoints1 * (unsigned) ndims1
+ * sizeof(ptdata1[0]);
+ HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
- ptdata1 = (hsize_t *)HDmalloc((size_t)alloc_size);
- H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t);
- H5Sget_select_elem_pointlist(region1_id, (hsize_t)0, (hsize_t)npoints1, ptdata1);
+ ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size);
+ H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
+ H5Sget_select_elem_pointlist(region1_id, (hsize_t) 0,
+ (hsize_t) npoints1, ptdata1);
- ptdata2 = (hsize_t *)HDmalloc((size_t)alloc_size);
- H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t);
- H5Sget_select_elem_pointlist(region2_id, (hsize_t)0, (hsize_t)npoints2, ptdata2);
+ ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size);
+ H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
+ H5Sget_select_elem_pointlist(region2_id, (hsize_t) 0,
+ (hsize_t) npoints2, ptdata2);
- for(i = 0; i < npoints1; i++) {
+ for (i = 0; i < npoints1; i++) {
hsize_t pt1, pt2;
- for(j = 0; j < ndims1; j++) {
+ for (j = 0; j < ndims1; j++) {
pt1 = ptdata1[i * ndims1 + j];
pt2 = ptdata2[i * ndims1 + j];
- if(pt1 != pt2)
+ if (pt1 != pt2)
nfound_p++;
}
}
- if(nfound_p && options->m_verbose) {
+ if (nfound_p && options->m_verbose) {
parallel_print("Region points\n");
- for(i = 0; i < npoints1; i++) {
+ for (i = 0; i < npoints1; i++) {
hsize_t pt1, pt2;
- int diff_data = 0;
+ int diff_data = 0;
- for(j = 0; j < ndims1; j++) {
+ for (j = 0; j < ndims1; j++) {
pt1 = ptdata1[i * ndims1 + j];
pt2 = ptdata2[i * ndims1 + j];
- if(pt1 != pt2) {
+ if (pt1 != pt2) {
diff_data = 1;
break;
}
}
- if(diff_data) {
+ if (diff_data) {
parallel_print("point #%d", i);
print_points(i, ptdata1, ndims1);
print_points(i, ptdata2, ndims1);
@@ -2786,7 +2138,6 @@ hsize_t diff_region(hid_t obj1_id,
}
}
-
#if defined (H5DIFF_DEBUG)
for (i = 0; i < npoints1; i++) {
int j;
@@ -2794,8 +2145,8 @@ hsize_t diff_region(hid_t obj1_id,
parallel_print("%sPt%lu: " , i ? "," : "", (unsigned long)i);
for (j = 0; j < ndims1; j++)
- parallel_print("%s%lu", j ? "," : "(",
- (unsigned long)(ptdata1[i * ndims1 + j]));
+ parallel_print("%s%lu", j ? "," : "(",
+ (unsigned long)(ptdata1[i * ndims1 + j]));
parallel_print(")");
}
@@ -2805,12 +2156,11 @@ hsize_t diff_region(hid_t obj1_id,
HDfree(ptdata2);
}
- nfound_b = nfound_b / (unsigned)ndims1;
- nfound_p = nfound_p / (unsigned)ndims1;
+ nfound_b = nfound_b / (unsigned) ndims1;
+ nfound_p = nfound_p / (unsigned) ndims1;
return (nfound_p + nfound_b);
}
-
/*-------------------------------------------------------------------------
* Function: character_compare
*
@@ -2821,33 +2171,18 @@ hsize_t diff_region(hid_t obj1_id,
*-------------------------------------------------------------------------
*/
-static
-hsize_t character_compare(char *mem1,
- char *mem2,
- hsize_t i,
- size_t u,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-{
- hsize_t nfound=0; /* differences found */
- char temp1_uchar;
- char temp2_uchar;
+static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
+ int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1, const char *obj2, int *ph) {
+ hsize_t nfound = 0; /* differences found */
+ char temp1_uchar;
+ char temp2_uchar;
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- h5diffdebug3("character_compare start %d=%d\n",temp1_uchar,temp2_uchar);
+ HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); h5diffdebug3("character_compare start %d=%d\n",temp1_uchar,temp2_uchar);
- if (temp1_uchar != temp2_uchar)
- {
- if ( print_data(options) )
- {
- print_char_pos(ph,0,i,u,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_uchar != temp2_uchar) {
+ if (print_data(options)) {
+ print_char_pos(ph, 0, i, u, acc, pos, rank, dims, obj1, obj2);
parallel_print(" ");
h5diff_print_char(temp1_uchar);
parallel_print(" ");
@@ -2861,7 +2196,6 @@ hsize_t character_compare(char *mem1,
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: character_compare_opt
*
@@ -2872,23 +2206,13 @@ hsize_t character_compare(char *mem1,
*-------------------------------------------------------------------------
*/
-static hsize_t character_compare_opt(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t i,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-{
- hsize_t nfound=0; /* differences found */
- unsigned char temp1_uchar;
- unsigned char temp2_uchar;
- double per;
- hbool_t both_zero;
+static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
+ hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1, const char *obj2, int *ph) {
+ hsize_t nfound = 0; /* differences found */
+ unsigned char temp1_uchar;
+ unsigned char temp2_uchar;
+ double per;
+ hbool_t both_zero;
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -2896,66 +2220,52 @@ static hsize_t character_compare_opt(unsigned char *mem1,
h5difftrace("character_compare_opt start\n");
/* -d and !-p */
- if (options->d && !options->p)
- {
- if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (!options->d && options->p) {
+ PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
+ if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per);
+ parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
nfound++;
}
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
- if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ else if (options->d && options->p) {
+ PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
+ if (per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per);
+ parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
nfound++;
}
}
- else if (temp1_uchar != temp2_uchar)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_uchar != temp2_uchar) {
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
- }
- h5difftrace("character_compare_opt finish\n");
+ } h5difftrace("character_compare_opt finish\n");
return nfound;
-
}
-
/*-------------------------------------------------------------------------
* Function: diff_float
*
@@ -2965,273 +2275,210 @@ static hsize_t character_compare_opt(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_float(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
+static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- float temp1_float;
- float temp2_float;
- hsize_t i;
- double per;
- hbool_t both_zero;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
+ hsize_t nfound = 0; /* number of differences found */
+ float temp1_float;
+ float temp2_float;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
h5difftrace("diff_float start\n");
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_FLOAT,&temp1_float);
- isnan2 = my_isnan(FLT_FLOAT,&temp2_float);
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
+ isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
- if ((double)ABS(temp1_float-temp2_float) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (!isnan1 && !isnan2) {
+ if ((double) ABS(temp1_float - temp2_float) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- mem1+=sizeof(float);
- mem2+=sizeof(float);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(float);
+ mem2 += sizeof(float);
+ if (options->n && nfound >= options->count)
return nfound;
} /* i */
}
-
- /*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ /*-------------------------------------------------------------------------
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_FLOAT,&temp1_float);
- isnan2 = my_isnan(FLT_FLOAT,&temp2_float);
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
+ isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
/* both not NaN, do the comparison */
- if ( (!isnan1 && !isnan2))
- {
-
- PER(temp1_float,temp2_float);
+ if ((!isnan1 && !isnan2)) {
+ PER(temp1_float, temp2_float);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float,
- (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
- (double)ABS(temp1_float - temp2_float),
- (double)ABS(1 - temp2_float / temp1_float));
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
+ (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
}
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- mem1+=sizeof(float);
- mem2+=sizeof(float);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(float);
+ mem2 += sizeof(float);
+ if (options->n && nfound >= options->count)
return nfound;
} /* i */
}
-
- /*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
+ /*-------------------------------------------------------------------------
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_FLOAT,&temp1_float);
- isnan2 = my_isnan(FLT_FLOAT,&temp2_float);
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
+ isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
+ if (!isnan1 && !isnan2) {
+ PER(temp1_float, temp2_float);
- PER(temp1_float,temp2_float);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float,
- (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && (double)ABS(temp1_float - temp2_float) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
- (double)ABS(temp1_float - temp2_float),
- (double)ABS(1 - temp2_float / temp1_float));
- }
- nfound++;
+ else if (per > options->percent && (double) ABS(temp1_float - temp2_float) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
+ (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
}
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- mem1+=sizeof(float);
- mem2+=sizeof(float);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(float);
+ mem2 += sizeof(float);
+ if (options->n && nfound >= options->count)
return nfound;
} /* i */
}
- /*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ /*-------------------------------------------------------------------------
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
- if (equal_float(temp1_float,temp2_float,options)==FALSE)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (equal_float(temp1_float, temp2_float, options) == FALSE) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- mem1+=sizeof(float);
- mem2+=sizeof(float);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(float);
+ mem2 += sizeof(float);
+ if (options->n && nfound >= options->count)
return nfound;
-
} /* nelmts */
-
-
-
-
-
}
h5difftrace("diff_float finish\n");
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: diff_double
*
@@ -3241,279 +2488,209 @@ static hsize_t diff_float(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_double(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
+static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- double temp1_double;
- double temp2_double;
- hsize_t i;
- double per;
- hbool_t both_zero;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
+ hsize_t nfound = 0; /* number of differences found */
+ double temp1_double;
+ double temp2_double;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
h5difftrace("diff_double start\n");
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_DOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
- if (ABS(temp1_double-temp2_double) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (!isnan1 && !isnan2) {
+ if (ABS(temp1_double-temp2_double) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(double);
+ mem2 += sizeof(double);
+ if (options->n && nfound >= options->count)
return nfound;
} /* i */
}
- /*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ /*-------------------------------------------------------------------------
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_DOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double, temp2_double);
- PER(temp1_double,temp2_double);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double,
+ ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(double);
+ mem2 += sizeof(double);
+ if (options->n && nfound >= options->count)
return nfound;
} /* i */
}
+ /*-------------------------------------------------------------------------
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (options->d && options->p) {
- /*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_DOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double, temp2_double);
- PER(temp1_double,temp2_double);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_double-temp2_double) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double,
+ ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
-
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
-
}
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(double);
+ mem2 += sizeof(double);
+ if (options->n && nfound >= options->count)
return nfound;
} /* i */
}
-
- /*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
- else
- {
-
-
-
- for ( i = 0; i < nelmts; i++)
- {
+ /*-------------------------------------------------------------------------
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
-
- if (equal_double(temp1_double,temp2_double,options)==FALSE)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (equal_double(temp1_double, temp2_double, options) == FALSE) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(double);
+ mem2 += sizeof(double);
+ if (options->n && nfound >= options->count)
return nfound;
-
} /* nelmts */
-
-
-
-
-
}
h5difftrace("diff_double finish\n");
return nfound;
}
-
-
-
-
/*-------------------------------------------------------------------------
* Function: diff_ldouble
*
@@ -3526,20 +2703,20 @@ static hsize_t diff_double(unsigned char *mem1,
#if H5_SIZEOF_LONG_DOUBLE !=0
static hsize_t diff_ldouble(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph)
{
- hsize_t nfound=0; /* number of differences found */
+ hsize_t nfound=0; /* number of differences found */
long double temp1_double;
long double temp2_double;
hsize_t i;
@@ -3550,245 +2727,183 @@ static hsize_t diff_ldouble(unsigned char *mem1,
h5difftrace("diff_ldouble start\n");
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for ( i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
- if (ABS(temp1_double-temp2_double) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (!isnan1 && !isnan2) {
+ if (ABS(temp1_double-temp2_double) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - emp2_double));
}
nfound++;
}
- mem1+=sizeof(long double);
- mem2+=sizeof(long double);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(long double);
+ mem2 += sizeof(long double);
+ if (options->n && nfound >= options->count)
return nfound;
} /* i */
}
- /*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ /*-------------------------------------------------------------------------
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
-
- PER(temp1_double,temp2_double);
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double, temp2_double);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double,
+ ABS(temp1_double - temp2_double), ABS(1-temp2_double / temp1_double));
}
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start+i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
-
}
- mem1+=sizeof(long double);
- mem2+=sizeof(long double);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(long double);
+ mem2 += sizeof(long double);
+ if (options->n && nfound >= options->count)
return nfound;
} /* i */
}
-
- /*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
+ /*-------------------------------------------------------------------------
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if ( options->do_nans )
- {
- isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
- isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (options->do_nans) {
+ isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
+ isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2)
- {
-
- PER(temp1_double,temp2_double);
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double, temp2_double);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
- else
-
- if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_double - temp2_double) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1-temp2_double / temp1_double));
}
-
+ nfound++;
+ }
}
/* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
-
}
- mem1+=sizeof(long double);
- mem2+=sizeof(long double);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(long double);
+ mem2 += sizeof(long double);
+ if (options->n && nfound >= options->count)
return nfound;
} /* i */
}
-
- /*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
- else
- {
-
-
-
- for ( i = 0; i < nelmts; i++)
- {
+ /*-------------------------------------------------------------------------
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
-
- if (equal_ldouble(temp1_double,temp2_double,options)==FALSE)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (equal_ldouble(temp1_double, temp2_double, options) == FALSE) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
-
- mem1+=sizeof(long double);
- mem2+=sizeof(long double);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(long double);
+ mem2 += sizeof(long double);
+ if (options->n && nfound >= options->count)
return nfound;
-
} /* nelmts */
-
-
-
-
-
}
h5difftrace("diff_ldouble finish\n");
@@ -3796,11 +2911,6 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
#endif /* H5_SIZEOF_LONG_DOUBLE */
-
-
-
-
-
/*-------------------------------------------------------------------------
* Function: diff_schar
*
@@ -3810,171 +2920,125 @@ static hsize_t diff_ldouble(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_schar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
+static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- char temp1_char;
- char temp2_char;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t nfound = 0; /* number of differences found */
+ char temp1_char;
+ char temp2_char;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_schar start\n");
-
/* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
- if (ABS(temp1_char-temp2_char) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (ABS(temp1_char-temp2_char) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- mem1+=sizeof(char);
- mem2+=sizeof(char);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(char);
+ mem2 += sizeof(char);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
-
/* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
- PER(temp1_char,temp2_char);
+ PER(temp1_char, temp2_char);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,
- ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_char,temp2_char,
- ABS(temp1_char-temp2_char),
- per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
}
- mem1+=sizeof(char);
- mem2+=sizeof(char);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(char);
+ mem2 += sizeof(char);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
-
/* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
- PER(temp1_char,temp2_char);
+ PER(temp1_char, temp2_char);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,
- ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else
- if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_char,temp2_char,
- ABS(temp1_char-temp2_char),
- per);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_char-temp2_char) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
}
- mem1+=sizeof(char);
- mem2+=sizeof(char);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(char);
+ mem2 += sizeof(char);
+ if (options->n && nfound >= options->count)
return nfound;
}
-
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
- if (temp1_char != temp2_char)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_char != temp2_char) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- mem1+=sizeof(char);
- mem2+=sizeof(char);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(char);
+ mem2 += sizeof(char);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
-
}
h5difftrace("diff_schar finish\n");
return nfound;
}
-
-
/*-------------------------------------------------------------------------
* Function: diff_uchar
*
@@ -3984,159 +3048,118 @@ static hsize_t diff_schar(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_uchar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned char temp1_uchar;
unsigned char temp2_uchar;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_uchar start\n");
-
/* -d and !-p */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned char);
+ mem2 += sizeof(unsigned char);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
-
/* !-d and -p */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
+ PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,
- PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,
- PDIFF(temp1_uchar,temp2_uchar),
- per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
- mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned char);
+ mem2 += sizeof(unsigned char);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
-
/* -d and -p */
- else if ( options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
+ PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,
- PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else
- if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,
- PDIFF(temp1_uchar,temp2_uchar),
- per);
- }
- nfound++;
+ else if (per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
- mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned char);
+ mem2 += sizeof(unsigned char);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- if (temp1_uchar != temp2_uchar)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_uchar != temp2_uchar) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned char);
+ mem2 += sizeof(unsigned char);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
-
}
h5difftrace("diff_uchar finish\n");
@@ -4152,155 +3175,116 @@ static hsize_t diff_uchar(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_short(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- short temp1_short;
- short temp2_short;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t nfound = 0; /* number of differences found */
+ short temp1_short;
+ short temp2_short;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_short start\n");
/* -d and !-p */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
- if (ABS(temp1_short-temp2_short) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (ABS(temp1_short-temp2_short) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- mem1+=sizeof(short);
- mem2+=sizeof(short);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(short);
+ mem2 += sizeof(short);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
-
/* !-d and -p */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
- PER(temp1_short,temp2_short);
+ PER(temp1_short, temp2_short);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,
- ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_short,temp2_short,
- ABS(temp1_short-temp2_short),
- per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
}
- mem1+=sizeof(short);
- mem2+=sizeof(short);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(short);
+ mem2 += sizeof(short);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
-
/* -d and -p */
- else if ( options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
- PER(temp1_short,temp2_short);
+ PER(temp1_short, temp2_short);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,
- ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else
- if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_short,temp2_short,
- ABS(temp1_short-temp2_short),
- per);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_short-temp2_short) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
}
- mem1+=sizeof(short);
- mem2+=sizeof(short);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(short);
+ mem2 += sizeof(short);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
- if (temp1_short != temp2_short)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_short != temp2_short) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- mem1+=sizeof(short);
- mem2+=sizeof(short);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(short);
+ mem2 += sizeof(short);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
}
@@ -4309,7 +3293,6 @@ static hsize_t diff_short(unsigned char *mem1,
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: diff_ushort
*
@@ -4319,163 +3302,125 @@ static hsize_t diff_short(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_ushort(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
+static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned short temp1_ushort;
unsigned short temp2_ushort;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_ushort start\n");
/* -d and !-p */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
- if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (PDIFF(temp1_ushort,temp2_ushort) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned short);
+ mem2 += sizeof(unsigned short);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
- PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
+ PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,
- PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,
- PDIFF(temp1_ushort,temp2_ushort),
- per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
}
- mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned short);
+ mem2 += sizeof(unsigned short);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
- PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
+ PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,
- PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else
- if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,
- PDIFF(temp1_ushort,temp2_ushort),
- per);
- }
- nfound++;
+ else if (per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
}
- mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned short);
+ mem2 += sizeof(unsigned short);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
- if (temp1_ushort != temp2_ushort)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_ushort != temp2_ushort) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned short);
+ mem2 += sizeof(unsigned short);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
-
}
h5difftrace("diff_ushort finish\n");
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: diff_int
*
@@ -4485,163 +3430,124 @@ static hsize_t diff_ushort(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_int(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- int temp1_int;
- int temp2_int;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t nfound = 0; /* number of differences found */
+ int temp1_int;
+ int temp2_int;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_int start\n");
/* -d and !-p */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
- if (ABS(temp1_int-temp2_int) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (ABS(temp1_int-temp2_int) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
+ parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(int);
+ mem2 += sizeof(int);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
- PER(temp1_int,temp2_int);
+ PER(temp1_int, temp2_int);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,
- ABS(temp1_int-temp2_int));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_int,temp2_int,
- ABS(temp1_int-temp2_int),
- per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
}
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(int);
+ mem2 += sizeof(int);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
- PER(temp1_int,temp2_int);
+ PER(temp1_int, temp2_int);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,
- ABS(temp1_int-temp2_int));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else
- if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_int,temp2_int,
- ABS(temp1_int-temp2_int),
- per);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_int-temp2_int) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
}
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(int);
+ mem2 += sizeof(int);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
- if (temp1_int != temp2_int)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_int != temp2_int) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
+ parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(int);
+ mem2 += sizeof(int);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
}
h5difftrace("diff_int finish\n");
-
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: diff_uint
*
@@ -4651,151 +3557,117 @@ static hsize_t diff_int(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_uint(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned int temp1_uint;
- unsigned int temp2_uint;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t nfound = 0; /* number of differences found */
+ unsigned int temp1_uint;
+ unsigned int temp2_uint;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_uint start\n");
/* -d and !-p */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
- if ( PDIFF(temp1_uint,temp2_uint) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (PDIFF(temp1_uint,temp2_uint) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned int);
+ mem2 += sizeof(unsigned int);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
- PER_UNSIGN(signed int,temp1_uint,temp2_uint);
+ PER_UNSIGN(signed int, temp1_uint, temp2_uint);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,
- PDIFF(temp1_uint,temp2_uint),
- per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
}
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned int);
+ mem2 += sizeof(unsigned int);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
- PER_UNSIGN(signed int,temp1_uint,temp2_uint);
+ PER_UNSIGN(signed int, temp1_uint, temp2_uint);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else
- if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,
- PDIFF(temp1_uint,temp2_uint),
- per);
- }
- nfound++;
+ else if (per > options->percent
+ && PDIFF(temp1_uint,temp2_uint) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
}
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned int);
+ mem2 += sizeof(unsigned int);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
- if (temp1_uint != temp2_uint)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_uint != temp2_uint) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned int);
+ mem2 += sizeof(unsigned int);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
}
@@ -4804,7 +3676,6 @@ static hsize_t diff_uint(unsigned char *mem1,
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: diff_long
*
@@ -4814,166 +3685,126 @@ static hsize_t diff_uint(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_long(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- long temp1_long;
- long temp2_long;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t nfound = 0; /* number of differences found */
+ long temp1_long;
+ long temp2_long;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_long start\n");
/* -d and !-p */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
- if (ABS(temp1_long-temp2_long) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (ABS(temp1_long-temp2_long) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long));
+ parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(long);
+ mem2 += sizeof(long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
- PER(temp1_long,temp2_long);
+ PER(temp1_long, temp2_long);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long));
+ parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long),
- per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
}
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(long);
+ mem2 += sizeof(long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
- PER(temp1_long,temp2_long);
+ PER(temp1_long, temp2_long);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long));
+ parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else
- if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long),
- per);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_long-temp2_long) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
}
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(long);
+ mem2 += sizeof(long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
- if (temp1_long != temp2_long)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_long != temp2_long) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long));
+ parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(long);
+ mem2 += sizeof(long);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
-
}
h5difftrace("diff_long finish\n");
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: diff_ulong
*
@@ -4983,155 +3814,120 @@ static hsize_t diff_long(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_ulong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned long temp1_ulong;
- unsigned long temp2_ulong;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t nfound = 0; /* number of differences found */
+ unsigned long temp1_ulong;
+ unsigned long temp2_ulong;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_ulong start\n");
/* -d and !-p */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
- if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (PDIFF(temp1_ulong,temp2_ulong) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned long);
+ mem2 += sizeof(unsigned long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
- PER_UNSIGN(signed long,temp1_ulong,temp2_ulong);
+ PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong,
- PDIFF(temp1_ulong,temp2_ulong),
- per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
}
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned long);
+ mem2 += sizeof(unsigned long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
- PER_UNSIGN(signed long,temp1_ulong,temp2_ulong);
+ PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else
- if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong,
- PDIFF(temp1_ulong,temp2_ulong),
- per);
- }
- nfound++;
+ else if (per > options->percent
+ && PDIFF(temp1_ulong,temp2_ulong) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
}
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned long);
+ mem2 += sizeof(unsigned long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
- if (temp1_ulong != temp2_ulong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_ulong != temp2_ulong) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned long);
+ mem2 += sizeof(unsigned long);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
}
@@ -5140,7 +3936,6 @@ static hsize_t diff_ulong(unsigned char *mem1,
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: diff_llong
*
@@ -5150,147 +3945,117 @@ static hsize_t diff_ulong(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_llong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- long long temp1_llong;
- long long temp2_llong;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t nfound = 0; /* number of differences found */
+ long long temp1_llong;
+ long long temp2_llong;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_llong start\n");
/* -d and !-p */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
- if (ABS( temp1_llong-temp2_llong) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (ABS( temp1_llong-temp2_llong) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
+ parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
nfound++;
}
- mem1+=sizeof(long long);
- mem2+=sizeof(long long);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(long long);
+ mem2 += sizeof(long long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
- PER(temp1_llong,temp2_llong);
+ PER(temp1_llong, temp2_llong);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
- }
- nfound++;
+ parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per);
- }
- nfound++;
- }
- mem1+=sizeof(long long);
- mem2+=sizeof(long long);
- if (options->n && nfound>=options->count)
- return nfound;
+ nfound++;
+ }
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
+ }
+ nfound++;
+ }
+ mem1 += sizeof(long long);
+ mem2 += sizeof(long long);
+ if (options->n && nfound >= options->count)
+ return nfound;
}
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
- PER(temp1_llong,temp2_llong);
+ PER(temp1_llong, temp2_llong);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
+ parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
nfound++;
}
- else
- if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per);
- }
- nfound++;
+ else if (per > options->percent
+ && ABS(temp1_llong-temp2_llong) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
}
- mem1+=sizeof(long long);
- mem2+=sizeof(long long);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(long long);
+ mem2 += sizeof(long long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
- if (temp1_llong != temp2_llong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_llong != temp2_llong) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
+ parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
nfound++;
}
- mem1+=sizeof(long long);
- mem2+=sizeof(long long);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(long long);
+ mem2 += sizeof(long long);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
}
@@ -5299,7 +4064,6 @@ static hsize_t diff_llong(unsigned char *mem1,
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: diff_ullong
*
@@ -5309,152 +4073,122 @@ static hsize_t diff_llong(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_ullong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
+static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc,
+ hsize_t *pos, diff_opt_t *options, const char *obj1, const char *obj2, int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned long long temp1_ullong;
- unsigned long long temp2_ullong;
- hsize_t i;
- float f1, f2;
- double per;
- hbool_t both_zero;
+ hsize_t nfound = 0; /* number of differences found */
+ unsigned long long temp1_ullong;
+ unsigned long long temp2_ullong;
+ hsize_t i;
+ float f1, f2;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_ullong start\n");
/* -d and !-p */
- if (options->d && !options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ if (options->d && !options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
- if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
}
nfound++;
}
- mem1+=sizeof(unsigned long long);
- mem2+=sizeof(unsigned long long);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned long long);
+ mem2 += sizeof(unsigned long long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (!options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
- ull2float(temp1_ullong,&f1);
- ull2float(temp2_ullong,&f2);
- PER(f1,f2);
+ ull2float(temp1_ullong, &f1);
+ ull2float(temp2_ullong, &f2);
+ PER(f1, f2);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
}
nfound++;
}
- else
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
}
- mem1+=sizeof(unsigned long long);
- mem2+=sizeof(unsigned long long);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned long long);
+ mem2 += sizeof(unsigned long long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else if (options->d && options->p) {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
- ull2float(temp1_ullong,&f1);
- ull2float(temp2_ullong,&f2);
- PER(f1,f2);
+ ull2float(temp1_ullong, &f1);
+ ull2float(temp2_ullong, &f2);
+ PER(f1, f2);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
}
nfound++;
}
- else
- if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
- }
- nfound++;
+ else if (per > options->percent
+ && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ parallel_print(SPACES);
+ parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
}
- mem1+=sizeof(unsigned long long);
- mem2+=sizeof(unsigned long long);
- if (options->n && nfound>=options->count)
+ nfound++;
+ }
+ mem1 += sizeof(unsigned long long);
+ mem2 += sizeof(unsigned long long);
+ if (options->n && nfound >= options->count)
return nfound;
}
}
- else
- {
- for ( i = 0; i < nelmts; i++)
- {
+ else {
+ for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
- if (temp1_ullong != temp2_ullong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ if (temp1_ullong != temp2_ullong) {
+ if (print_data(options)) {
+ print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
}
nfound++;
}
- mem1+=sizeof(unsigned long long);
- mem2+=sizeof(unsigned long long);
- if (options->n && nfound>=options->count)
+ mem1 += sizeof(unsigned long long);
+ mem2 += sizeof(unsigned long long);
+ if (options->n && nfound >= options->count)
return nfound;
} /* nelmts */
}
@@ -5463,7 +4197,6 @@ static hsize_t diff_ullong(unsigned char *mem1,
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: ull2float
*
@@ -5477,49 +4210,46 @@ static hsize_t diff_ullong(unsigned char *mem1,
*-------------------------------------------------------------------------
*/
static
-int ull2float(unsigned long long ull_value, float *f_value)
-{
- hid_t dxpl_id;
- unsigned char *buf = NULL;
- size_t src_size;
- size_t dst_size;
+int ull2float(unsigned long long ull_value, float *f_value) {
+ hid_t dxpl_id;
+ unsigned char *buf = NULL;
+ size_t src_size;
+ size_t dst_size;
h5difftrace("ull2float start\n");
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0)
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
src_size = H5Tget_size(H5T_NATIVE_ULLONG);
dst_size = H5Tget_size(H5T_NATIVE_FLOAT);
- buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size));
- if(!buf)
+ buf = (unsigned char*) HDcalloc((size_t )1, MAX(src_size, dst_size));
+ if (!buf)
goto error;
HDmemcpy(buf, &ull_value, src_size);
/* do conversion */
- if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0)
+ if (H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t) 1, buf, NULL, dxpl_id) < 0)
goto error;
HDmemcpy(f_value, buf, dst_size);
- if(buf)
- HDfree(buf);
- h5difftrace("ull2float finish\n");
+ if (buf)
+ HDfree(buf);h5difftrace("ull2float finish\n");
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dxpl_id);
- } H5E_END_TRY;
- if(buf)
- HDfree(buf);
- h5difftrace("ull2float errored\n");
+ }H5E_END_TRY;
+ if (buf)
+ HDfree(buf);h5difftrace("ull2float errored\n");
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: equal_double
*
@@ -5531,26 +4261,21 @@ error:
*
*-------------------------------------------------------------------------
*/
-static
-hbool_t equal_double(double value, double expected, diff_opt_t *options)
-{
+static hbool_t equal_double(double value, double expected, diff_opt_t *options) {
h5difftrace("equal_double start\n");
- if ( options->do_nans )
- {
-
+ if (options->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- hbool_t isnan1 = my_isnan(FLT_DOUBLE,&value);
- hbool_t isnan2 = my_isnan(FLT_DOUBLE,&expected);
+ hbool_t isnan1 = my_isnan(FLT_DOUBLE, &value);
+ hbool_t isnan2 = my_isnan(FLT_DOUBLE, &expected);
/*-------------------------------------------------------------------------
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
*/
- if ( isnan1 && isnan2 )
- {
+ if (isnan1 && isnan2) {
return TRUE;
}
@@ -5558,8 +4283,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options)
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
*/
- if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
- {
+ if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
return FALSE;
}
}
@@ -5590,31 +4314,27 @@ static
hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options)
{
h5difftrace("equal_ldouble start\n");
- if ( options->do_nans )
- {
-
+ if (options->do_nans) {
/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- hbool_t isnan1 = my_isnan(FLT_LDOUBLE,&value);
- hbool_t isnan2 = my_isnan(FLT_LDOUBLE,&expected);
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ hbool_t isnan1 = my_isnan(FLT_LDOUBLE, &value);
+ hbool_t isnan2 = my_isnan(FLT_LDOUBLE, &expected);
/*-------------------------------------------------------------------------
- * we consider NaN == NaN to be true
- *-------------------------------------------------------------------------
- */
- if ( isnan1 && isnan2 )
- {
+ * we consider NaN == NaN to be true
+ *-------------------------------------------------------------------------
+ */
+ if (isnan1 && isnan2) {
return TRUE;
}
/*-------------------------------------------------------------------------
- * one is a NaN, do not compare but assume difference
- *-------------------------------------------------------------------------
- */
- if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
- {
+ * one is a NaN, do not compare but assume difference
+ *-------------------------------------------------------------------------
+ */
+ if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
return FALSE;
}
}
@@ -5623,7 +4343,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
return TRUE;
if (options->use_system_epsilon) {
- if ( ABS( (value-expected) ) < DBL_EPSILON)
+ if (ABS((value-expected)) < DBL_EPSILON)
return TRUE;
}
h5difftrace("equal_ldouble finish\n");
@@ -5633,7 +4353,6 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
#endif /* #if H5_SIZEOF_LONG_DOUBLE !=0 */
-
/*-------------------------------------------------------------------------
* Function: equal_float
*
@@ -5645,35 +4364,29 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
*
*-------------------------------------------------------------------------
*/
-static
-hbool_t equal_float(float value, float expected, diff_opt_t *options)
-{
+static hbool_t equal_float(float value, float expected, diff_opt_t *options) {
h5difftrace("equal_float start\n");
- if ( options->do_nans )
- {
-
+ if (options->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- hbool_t isnan1 = my_isnan(FLT_FLOAT,&value);
- hbool_t isnan2 = my_isnan(FLT_FLOAT,&expected);
+ hbool_t isnan1 = my_isnan(FLT_FLOAT, &value);
+ hbool_t isnan2 = my_isnan(FLT_FLOAT, &expected);
/*-------------------------------------------------------------------------
- * we consider NaN == NaN to be true
- *-------------------------------------------------------------------------
- */
- if ( isnan1 && isnan2 )
- {
+ * we consider NaN == NaN to be true
+ *-------------------------------------------------------------------------
+ */
+ if (isnan1 && isnan2) {
return TRUE;
}
/*-------------------------------------------------------------------------
- * one is a NaN, do not compare but assume difference
- *-------------------------------------------------------------------------
- */
- if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
- {
+ * one is a NaN, do not compare but assume difference
+ *-------------------------------------------------------------------------
+ */
+ if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
return FALSE;
}
}
@@ -5691,8 +4404,6 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
}
-
-
/*-------------------------------------------------------------------------
* Function: my_isnan
*
@@ -5709,81 +4420,68 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
*
*-------------------------------------------------------------------------
*/
-static hbool_t
-my_isnan(dtype_t type, void *val)
-{
+static hbool_t my_isnan(dtype_t type, void *val) {
hbool_t retval = FALSE;
char s[256];
h5difftrace("my_isnan start\n");
- if (FLT_FLOAT==type)
- {
+ if (FLT_FLOAT == type) {
float x;
HDmemcpy(&x, val, sizeof(float));
- retval = (x!=x);
+ retval = (x != x);
}
- else if (FLT_DOUBLE==type)
- {
+ else if (FLT_DOUBLE == type) {
double x;
HDmemcpy(&x, val, sizeof(double));
- retval = (x!=x);
+ retval = (x != x);
}
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- else if (FLT_LDOUBLE==type)
- {
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ else if (FLT_LDOUBLE == type) {
long double x;
HDmemcpy(&x, val, sizeof(long double));
retval = (x!=x);
}
#endif
- else
- {
+ else {
return FALSE;
}
- /*
+ /*
* Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if
* the result contains a NaN string.
*/
- if (!retval)
- {
- if (FLT_FLOAT==type)
- {
+ if (!retval) {
+ if (FLT_FLOAT == type) {
float x;
HDmemcpy(&x, val, sizeof(float));
- HDsnprintf(s, sizeof(s), "%g", (double)x);
+ HDsnprintf(s, sizeof(s), "%g", (double) x);
}
- else if (FLT_DOUBLE==type)
- {
+ else if (FLT_DOUBLE == type) {
double x;
HDmemcpy(&x, val, sizeof(double));
HDsnprintf(s, sizeof(s), "%g", x);
}
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- else if (FLT_LDOUBLE==type)
- {
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0
+ else if (FLT_LDOUBLE == type) {
long double x;
HDmemcpy(&x, val, sizeof(long double));
HDsnprintf(s, sizeof(s), "%Lg", x);
}
#endif
- else
- {
+ else {
return FALSE;
}
- if ( HDstrstr(s, "NaN") ||
- HDstrstr(s, "NAN") ||
- HDstrstr(s, "nan") ||
- HDstrstr(s, "-1.#IND") /* WIN32 */
- )
- {
+ if (HDstrstr(s, "NaN") ||
+ HDstrstr(s, "NAN") ||
+ HDstrstr(s, "nan") ||
+ HDstrstr(s, "-1.#IND")) {
retval = TRUE;
}
}
@@ -5793,7 +4491,6 @@ my_isnan(dtype_t type, void *val)
return retval;
}
-
/*-------------------------------------------------------------------------
*
* Local functions
@@ -5808,9 +4505,8 @@ my_isnan(dtype_t type, void *val)
*-------------------------------------------------------------------------
*/
static
-int print_data(diff_opt_t *options)
-{
- return ( (options->m_report || options->m_verbose) && !options->m_quiet)?1:0;
+int print_data(diff_opt_t *options) {
+ return ((options->m_report || options->m_verbose) && !options->m_quiet) ? 1 : 0;
}
/*-------------------------------------------------------------------------
@@ -5820,37 +4516,28 @@ int print_data(diff_opt_t *options)
*
*-------------------------------------------------------------------------
*/
-
static
-void print_header(int pp, /* print percentage */
- int rank,
- hsize_t *dims,
- const char *obj1,
- const char *obj2 )
-{
+void print_header(int pp, /* print percentage */
+ int rank, hsize_t *dims, const char *obj1, const char *obj2) {
/* print header */
- parallel_print("%-16s","size:");
- print_dimensions (rank,dims);
- parallel_print("%-11s","");
- print_dimensions (rank,dims);
+ parallel_print("%-16s", "size:");
+ print_dimensions(rank, dims);
+ parallel_print("%-11s", "");
+ print_dimensions(rank, dims);
parallel_print("\n");
- if(pp) {
- parallel_print("%-15s %-15s %-15s %-15s %-15s\n",
- "position",
- (obj1!=NULL) ? obj1 : " ",
- (obj2!=NULL) ? obj2 : " ",
- "difference",
- "relative");
- parallel_print("------------------------------------------------------------------------\n");
+ if (pp) {
+ parallel_print("%-15s %-15s %-15s %-15s %-15s\n", "position",
+ (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference",
+ "relative");
+ parallel_print(
+ "------------------------------------------------------------------------\n");
}
else {
- parallel_print("%-15s %-15s %-15s %-20s\n",
- "position",
- (obj1!=NULL) ? obj1 : " ",
- (obj2!=NULL) ? obj2 : " ",
- "difference");
- parallel_print("------------------------------------------------------------\n");
+ parallel_print("%-15s %-15s %-15s %-20s\n", "position",
+ (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference");
+ parallel_print(
+ "------------------------------------------------------------\n");
}
}
@@ -5861,48 +4548,36 @@ void print_header(int pp, /* print percentage */
*
*-------------------------------------------------------------------------
*/
-
static
-void print_pos( int *ph, /* print header */
- int pp, /* print percentage */
- hsize_t curr_pos,
- hsize_t *acc,
- hsize_t *pos,
- int rank,
- hsize_t *dims,
- const char *obj1,
- const char *obj2 )
-{
+void print_pos(int *ph, /* print header */
+ int pp, /* print percentage */
+ hsize_t curr_pos, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims,
+ const char *obj1, const char *obj2) {
int i;
/* print header */
- if ( *ph==1 )
- {
- *ph=0;
+ if (*ph == 1) {
+ *ph = 0;
print_header(pp, rank, dims, obj1, obj2);
} /* end print header */
- for ( i = 0; i < rank; i++)
- {
- pos[i] = curr_pos/acc[i];
- curr_pos -= acc[i]*pos[i];
+ for (i = 0; i < rank; i++) {
+ pos[i] = curr_pos / acc[i];
+ curr_pos -= acc[i] * pos[i];
}
- HDassert( curr_pos == 0 );
+ HDassert(curr_pos == 0);
- if ( rank > 0 )
- {
- parallel_print("[ " );
- for ( i = 0; i < rank; i++)
- {
+ if (rank > 0) {
+ parallel_print("[ ");
+ for (i = 0; i < rank; i++) {
parallel_print(HSIZE_T_FORMAT, (unsigned long long)pos[i]);
parallel_print(" ");
}
- parallel_print("]" );
+ parallel_print("]");
}
- else
- {
- parallel_print(" ");
+ else {
+ parallel_print(" ");
}
}
@@ -5913,52 +4588,38 @@ void print_pos( int *ph, /* print header */
*
*-------------------------------------------------------------------------
*/
-
static
-void print_char_pos( int *ph, /* print header */
- int pp, /* print percentage */
- hsize_t curr_pos,
- size_t u,
- hsize_t *acc,
- hsize_t *pos,
- int rank,
- hsize_t *dims,
- const char *obj1,
- const char *obj2 )
-{
+void print_char_pos(int *ph, /* print header */
+ int pp, /* print percentage */
+ hsize_t curr_pos, size_t u, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims,
+ const char *obj1, const char *obj2) {
int i;
/* print header */
- if ( *ph==1 )
- {
- *ph=0;
+ if (*ph == 1) {
+ *ph = 0;
print_header(pp, rank, dims, obj1, obj2);
} /* end print header */
- for ( i = 0; i < rank; i++)
- {
- pos[i] = curr_pos/acc[i];
- curr_pos -= acc[i]*pos[i];
+ for (i = 0; i < rank; i++) {
+ pos[i] = curr_pos / acc[i];
+ curr_pos -= acc[i] * pos[i];
}
- HDassert( curr_pos == 0 );
+ HDassert(curr_pos == 0);
- parallel_print("[ " );
- if ( rank > 0 )
- {
-
- for ( i = 0; i < rank; i++)
- {
+ parallel_print("[ ");
+ if (rank > 0) {
+ for (i = 0; i < rank; i++) {
parallel_print(HSIZE_T_FORMAT, (unsigned long long)pos[i]);
parallel_print(" ");
}
}
- else
- {
+ else {
parallel_print("%zu", u);
}
- parallel_print("]" );
+ parallel_print("]");
}
/*-------------------------------------------------------------------------
@@ -5968,16 +4629,13 @@ void print_char_pos( int *ph, /* print header */
*
*-------------------------------------------------------------------------
*/
-static void h5diff_print_char(char ch)
-{
-
- switch (ch)
- {
+static void h5diff_print_char(char ch) {
+ switch (ch) {
case '"':
parallel_print("\\\"");
break;
case '\\':
- parallel_print( "\\\\");
+ parallel_print("\\\\");
break;
case '\b':
parallel_print("\\b");
@@ -5996,60 +4654,53 @@ static void h5diff_print_char(char ch)
break;
default:
if (isprint(ch))
- parallel_print( "%c", ch);
+ parallel_print("%c", ch);
else
- parallel_print( "\\%03o", ch);
-
+ parallel_print("\\%03o", ch);
break;
}
}
-
/*-------------------------------------------------------------------------
* XCAO, 11/10/2010
* added to improve performance for compound datasets
* set up compound datatype structures.
*/
-static void get_member_types(hid_t tid, mcomp_t *members)
-{
+static void get_member_types(hid_t tid, mcomp_t *members) {
int tclass;
unsigned u;
- if (tid <=0 || !members)
+ if (tid <= 0 || !members)
return;
tclass = H5Tget_class(tid);
- if (tclass == H5T_ARRAY || tclass == H5T_VLEN)
- {
+ if (tclass == H5T_ARRAY || tclass == H5T_VLEN) {
hid_t base_tid = H5Tget_super(tid);
get_member_types(base_tid, members);
H5Tclose(base_tid);
}
- else if (tclass == H5T_COMPOUND)
- {
- int nmembs;
+ else if (tclass == H5T_COMPOUND) {
+ int nmembs;
nmembs = H5Tget_nmembers(tid);
- if(nmembs <= 0)
+ if (nmembs <= 0)
return;
- members->n = (unsigned)nmembs;
-
- members->ids = (hid_t *)HDcalloc((size_t)members->n, sizeof(hid_t));
- members->offsets = (size_t *)HDcalloc((size_t)members->n, sizeof(size_t));
- members->m = (mcomp_t **)HDcalloc((size_t)members->n, sizeof(mcomp_t *));
-
- for(u = 0; u < members->n; u++)
- {
- members->ids[u] = H5Tget_member_type( tid, u );
- members->offsets[u] = H5Tget_member_offset( tid, u );
- members->m[u] = (mcomp_t *)HDmalloc(sizeof(mcomp_t));
- HDmemset(members->m[u], 0, sizeof(mcomp_t));
- get_member_types(members->ids[u], members->m[u]);
+ members->n = (unsigned) nmembs;
+
+ members->ids = (hid_t *) HDcalloc((size_t )members->n, sizeof(hid_t));
+ members->offsets = (size_t *) HDcalloc((size_t )members->n, sizeof(size_t));
+ members->m = (mcomp_t **) HDcalloc((size_t )members->n, sizeof(mcomp_t *));
+
+ for (u = 0; u < members->n; u++) {
+ members->ids[u] = H5Tget_member_type(tid, u);
+ members->offsets[u] = H5Tget_member_offset(tid, u);
+ members->m[u] = (mcomp_t *) HDmalloc(sizeof(mcomp_t));
+ HDmemset(members->m[u], 0, sizeof(mcomp_t));
+ get_member_types(members->ids[u], members->m[u]);
}
}
- return;
-
+ return;
}
@@ -6058,17 +4709,14 @@ static void get_member_types(hid_t tid, mcomp_t *members)
* added to improve performance for compound datasets
* clean and close compound members.
*/
-static void close_member_types(mcomp_t *members)
-{
+static void close_member_types(mcomp_t *members) {
unsigned u;
- if (!members || members->n<=0 || !members->ids)
+ if (!members || members->n <= 0 || !members->ids)
return;
- for(u = 0; u < members->n; u++)
- {
- if(members->m[u])
- {
+ for (u = 0; u < members->n; u++) {
+ if (members->m[u]) {
close_member_types(members->m[u]);
HDfree(members->m[u]);
}