summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeon Arber <larber@ncsa.uiuc.edu>2004-10-18 22:46:04 (GMT)
committerLeon Arber <larber@ncsa.uiuc.edu>2004-10-18 22:46:04 (GMT)
commit24cb7fe160f72ef178695f6f441862cb3d596da5 (patch)
treeb5f44c5a9015231682aebdbd4cb697fdbec7040f /src
parentd8fdc955cc9cf13c6778a55c3502f2a7089ae472 (diff)
downloadhdf5-24cb7fe160f72ef178695f6f441862cb3d596da5.zip
hdf5-24cb7fe160f72ef178695f6f441862cb3d596da5.tar.gz
hdf5-24cb7fe160f72ef178695f6f441862cb3d596da5.tar.bz2
[svn-r9430] Purpose:
Bug fix. Description: The windows compiler apparently cannot convert from unsigned long long to double. This conversion is necessary for the data transform to work properly in some cases. Solution: Added #ifdef to check for windows and issue error when user attempts to do a data transform on a long long type. Platforms tested: sol + eirene
Diffstat (limited to 'src')
-rw-r--r--src/H5Ztrans.c1956
1 files changed, 272 insertions, 1684 deletions
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 70eeeb8..588e8be 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -108,6 +108,81 @@ static void H5Z_print(H5Z_node *tree, FILE *stream);
#endif /* H5Z_XFORM_DEBUG */
+#define H5Z_XFORM_DO_OP1(RESL,RESR,TYPE,OP,SIZE) \
+{ \
+ size_t u; \
+ TYPE* p; \
+ double tree_val; \
+ \
+ if((RESL).type == H5Z_XFORM_SYMBOL) \
+ { \
+ tree_val = ((RESR).type==H5Z_XFORM_INTEGER ? (RESR).value.int_val : (RESR).value.float_val); \
+ p = (TYPE*)(RESL).value.dat_val; \
+ } \
+ else \
+ { \
+ tree_val = ((RESL).type==H5Z_XFORM_INTEGER ? (RESL).value.int_val : (RESL).value.float_val); \
+ p = (TYPE*)(RESR).value.dat_val; \
+ } \
+ \
+ for(u=0; u<(SIZE); u++) \
+ *p++ OP tree_val; \
+}
+
+#define H5Z_XFORM_DO_OP2(RESL, RESR, TYPE, OP, SIZE) \
+{ \
+ size_t u; \
+ TYPE* pl = (TYPE*)(RESL).value.dat_val; \
+ TYPE* pr = (TYPE*)(RESR).value.dat_val; \
+ \
+ for(u=0; u<(SIZE); u++) \
+ *pl++ OP *pr++; \
+}
+
+#define H5Z_XFORM_DO_OP3(OP) \
+{ \
+ if((tree->lchild->type == H5Z_XFORM_INTEGER) && (tree->rchild->type==H5Z_XFORM_INTEGER)) \
+ { \
+ tree->type = H5Z_XFORM_INTEGER; \
+ tree->value.int_val = tree->lchild->value.int_val OP tree->rchild->value.int_val; \
+ H5MM_xfree(tree->lchild); \
+ H5MM_xfree(tree->rchild); \
+ tree->lchild = NULL; \
+ tree->rchild = NULL; \
+ } \
+ else if( ( (tree->lchild->type == H5Z_XFORM_FLOAT) || (tree->lchild->type == H5Z_XFORM_INTEGER)) && \
+ ( (tree->rchild->type == H5Z_XFORM_FLOAT) || (tree->rchild->type == H5Z_XFORM_INTEGER))) \
+ { \
+ tree->type = H5Z_XFORM_FLOAT; \
+ tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : tree->lchild->value.int_val) OP \
+ ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : tree->rchild->value.int_val); \
+ H5MM_xfree(tree->lchild); \
+ H5MM_xfree(tree->rchild); \
+ tree->lchild = NULL; \
+ tree->rchild = NULL; \
+ } \
+}
+
+#define H5Z_XFORM_DO_OP4(TYPE) \
+{ \
+ if ((ret_value = (H5Z_node*) H5MM_malloc(sizeof(H5Z_node))) == NULL) \
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree") \
+ else \
+ { \
+ ret_value->type = (TYPE); \
+ ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers); \
+ ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers); \
+ } \
+}
+
+#define H5Z_XFORM_DO_OP5(TYPE, SIZE) \
+{ \
+ TYPE val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val; \
+ H5V_array_fill(array, &val, sizeof(TYPE), (SIZE)); \
+}
+
+
+
/*
* Programmer: Bill Wendling <wendling@ncsa.uiuc.edu>
* 25. August 2003
@@ -684,6 +759,9 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
break;
case H5Z_XFORM_END:
HGOTO_DONE(factor)
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Invalid token while parsing data transform expression")
+
}
done:
@@ -757,92 +835,34 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size
/* If it's a trivial data transform, perform it */
if( tree->type == H5Z_XFORM_INTEGER || tree->type == H5Z_XFORM_FLOAT)
{
- if(array_type == H5T_NATIVE_CHAR)
- {
- char tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(char), array_size);
- }
- else if(array_type == H5T_NATIVE_UCHAR)
- {
- unsigned char tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(unsigned char), array_size);
- }
- else if(array_type == H5T_NATIVE_SCHAR)
- {
- signed char tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(signed char), array_size);
- }
-
- else if(array_type == H5T_NATIVE_SHORT)
- {
- short tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(short), array_size);
- }
- else if(array_type == H5T_NATIVE_USHORT)
- {
- unsigned short tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(unsigned short), array_size);
- }
-
- else if( array_type == H5T_NATIVE_INT)
- {
- int tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(int), array_size);
- }
- else if(array_type == H5T_NATIVE_UINT)
- {
- unsigned int tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(unsigned int), array_size);
- }
- else if(array_type == H5T_NATIVE_LONG)
- {
- long tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(long), array_size);
- }
- else if(array_type == H5T_NATIVE_ULONG)
- {
- unsigned long tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(unsigned long), array_size);
- }
- else if(array_type == H5T_NATIVE_LLONG)
- {
- long_long tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(long_long), array_size);
- }
- else if(array_type == H5T_NATIVE_ULLONG)
- {
- unsigned long_long tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(unsigned long_long), array_size);
- }
- else if(array_type == H5T_NATIVE_FLOAT)
- {
- float tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(float), array_size);
- }
+ if(array_type == H5T_NATIVE_CHAR)
+ H5Z_XFORM_DO_OP5(char, array_size)
+ else if(array_type == H5T_NATIVE_UCHAR)
+ H5Z_XFORM_DO_OP5(unsigned char, array_size)
+ else if(array_type == H5T_NATIVE_SCHAR)
+ H5Z_XFORM_DO_OP5(signed char, array_size)
+ else if(array_type == H5T_NATIVE_SHORT)
+ H5Z_XFORM_DO_OP5(short, array_size)
+ else if(array_type == H5T_NATIVE_USHORT)
+ H5Z_XFORM_DO_OP5(unsigned short, array_size)
+ else if( array_type == H5T_NATIVE_INT)
+ H5Z_XFORM_DO_OP5(int, array_size)
+ else if(array_type == H5T_NATIVE_UINT)
+ H5Z_XFORM_DO_OP5(unsigned int, array_size)
+ else if(array_type == H5T_NATIVE_LONG)
+ H5Z_XFORM_DO_OP5(long, array_size)
+ else if(array_type == H5T_NATIVE_ULONG)
+ H5Z_XFORM_DO_OP5(unsigned long, array_size)
+ else if(array_type == H5T_NATIVE_LLONG)
+ H5Z_XFORM_DO_OP5(long_long, array_size)
+ else if(array_type == H5T_NATIVE_ULLONG)
+ H5Z_XFORM_DO_OP5(unsigned long_long, array_size)
+ else if(array_type == H5T_NATIVE_FLOAT)
+ H5Z_XFORM_DO_OP5(float, array_size)
else if(array_type == H5T_NATIVE_DOUBLE)
- {
- double tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(double), array_size);
- }
+ H5Z_XFORM_DO_OP5(double, array_size)
else if(array_type == H5T_NATIVE_LDOUBLE)
- {
- long double tree_val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val;
-
- H5V_array_fill(array, &tree_val, sizeof(long double), array_size);
- }
+ H5Z_XFORM_DO_OP5(long double, array_size)
}
/* Otherwise, do the full data transform */
@@ -915,7 +935,6 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_
{
H5Z_result resl, resr;
- size_t i;
herr_t ret_value = SUCCEED;
@@ -959,390 +978,72 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_
if( ((resl.type == H5Z_XFORM_SYMBOL) && (resr.type != H5Z_XFORM_SYMBOL)) || ((resr.type == H5Z_XFORM_SYMBOL) && (resl.type != H5Z_XFORM_SYMBOL)))
{
if(array_type == H5T_NATIVE_CHAR)
- {
- char* charp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- charp = (char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- charp = (char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *charp++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, char, +=, array_size)
else if(array_type == H5T_NATIVE_UCHAR)
- {
- unsigned char* ucharp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ucharp = (unsigned char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ucharp = (unsigned char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ucharp++ += tree_val;
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned char, +=, array_size)
else if(array_type == H5T_NATIVE_SCHAR)
- {
- signed char* scharp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- scharp = (signed char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- scharp = (signed char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *scharp++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, signed char, +=, array_size)
else if(array_type == H5T_NATIVE_SHORT)
- {
- short* shortp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- shortp = (short*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- shortp = (short*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *shortp++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, short, +=, array_size)
else if(array_type == H5T_NATIVE_USHORT)
- {
- unsigned short* ushortp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ushortp = (unsigned short*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ushortp = (unsigned short*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ushortp++ += tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned short, +=, array_size)
else if(array_type == H5T_NATIVE_INT)
- {
- int* intp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- intp = (int*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- intp = (int*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *intp++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, int, +=, array_size)
else if(array_type == H5T_NATIVE_UINT)
- {
- unsigned int* uintp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- uintp = (unsigned int*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- uintp = (unsigned int*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *uintp++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned int, +=, array_size)
else if(array_type == H5T_NATIVE_LONG)
- {
- long* longp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- longp = (long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- longp = (long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *longp++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, long, +=, array_size)
else if(array_type == H5T_NATIVE_ULONG)
- {
- unsigned long* ulongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ulongp = (unsigned long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ulongp = (unsigned long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ulongp++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned long, +=, array_size)
else if(array_type == H5T_NATIVE_LLONG)
- {
- long_long* llongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- llongp = (long_long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- llongp = (long_long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *llongp++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, long_long, +=, array_size)
else if(array_type == H5T_NATIVE_ULLONG)
- {
- unsigned long_long* ullongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ullongp = (unsigned long_long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ullongp = (unsigned long_long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ullongp++ += tree_val;
- }
+ {
+#ifdef WIN32
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Cannot convert from unsigned int64 to double on win32")
+#else
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned long_long, +=, array_size)
+#endif
+ }
else if(array_type == H5T_NATIVE_FLOAT)
- {
- float* floatp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- floatp = (float*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- floatp = (float*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *floatp++ += tree_val;
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, float, +=, array_size)
else if(array_type == H5T_NATIVE_DOUBLE)
- {
- double* doublep;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- doublep = (double*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- doublep = (double*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *doublep++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, double, +=, array_size)
else if(array_type == H5T_NATIVE_LDOUBLE)
- {
- long double* ldoublep;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ldoublep = (long double*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ldoublep = (long double*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ldoublep++ += tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, long double, +=, array_size)
}
+
else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_SYMBOL))
{
- if(array_type == H5T_NATIVE_CHAR)
- {
- char* charpl = (char*)resl.value.dat_val;
- char* charpr = (char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *charpl++ += *charpr++;
- }
+ if(array_type == H5T_NATIVE_CHAR)
+ H5Z_XFORM_DO_OP2(resl, resr, char, +=, array_size)
else if(array_type == H5T_NATIVE_UCHAR)
- {
- unsigned char* ucharpl = (unsigned char*)resl.value.dat_val;
- unsigned char* ucharpr = (unsigned char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ucharpl++ += *ucharpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned char, +=, array_size)
else if(array_type == H5T_NATIVE_SCHAR)
- {
- signed char* scharpl = (signed char*)resl.value.dat_val;
- signed char* scharpr = (signed char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *scharpl++ += *scharpr++;
- }
- else if(array_type == H5T_NATIVE_INT)
- {
- int* intpl = (int*)resl.value.dat_val;
- int* intpr = (int*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *intpl++ += *intpr++;
- }
- else if(array_type == H5T_NATIVE_UINT)
- {
- unsigned int* uintpl = (unsigned int*)resl.value.dat_val;
- unsigned int* uintpr = (unsigned int*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *uintpl++ += *uintpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, signed char, +=, array_size)
else if(array_type == H5T_NATIVE_SHORT)
- {
- short* shortpl = (short*)resl.value.dat_val;
- short* shortpr = (short*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *shortpl++ += *shortpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, short, +=, array_size)
else if(array_type == H5T_NATIVE_USHORT)
- {
- unsigned short* ushortpl = (unsigned short*)resl.value.dat_val;
- unsigned short* ushortpr = (unsigned short*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ushortpl++ += *ushortpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned short, +=, array_size)
+ else if(array_type == H5T_NATIVE_INT)
+ H5Z_XFORM_DO_OP2(resl, resr, int, +=, array_size)
+ else if(array_type == H5T_NATIVE_UINT)
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned int, +=, array_size)
else if(array_type == H5T_NATIVE_LONG)
- {
- long* longpl = (long*)resl.value.dat_val;
- long* longpr = (long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *longpl++ += *longpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, long, +=, array_size)
else if(array_type == H5T_NATIVE_ULONG)
- {
- unsigned long* ulongpl = (unsigned long*)resl.value.dat_val;
- unsigned long* ulongpr = (unsigned long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ulongpl++ += *ulongpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned long, +=, array_size)
else if(array_type == H5T_NATIVE_LLONG)
- {
- long_long* llongpl = (long_long*)resl.value.dat_val;
- long_long* llongpr = (long_long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *llongpl++ += *llongpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, long_long, +=, array_size)
else if(array_type == H5T_NATIVE_ULLONG)
- {
- unsigned long_long* ullongpl = (unsigned long_long*)resl.value.dat_val;
- unsigned long_long* ullongpr = (unsigned long_long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ullongpl++ += *ullongpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned long_long, +=, array_size)
else if(array_type == H5T_NATIVE_FLOAT)
- {
- float* floatpl = (float*)resl.value.dat_val;
- float* floatpr = (float*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *floatpl++ += *floatpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, float, +=, array_size)
else if(array_type == H5T_NATIVE_DOUBLE)
- {
- double* doublepl = (double*)resl.value.dat_val;
- double* doublepr = (double*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *doublepl++ += *doublepr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, double, +=, array_size)
else if(array_type == H5T_NATIVE_LDOUBLE)
- {
- long double* ldoublepl = (long double*)resl.value.dat_val;
- long double* ldoublepr = (long double*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ldoublepl++ += *ldoublepr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, long double, +=, array_size)
+
}
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation")
@@ -1352,400 +1053,73 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_
if( ((resl.type == H5Z_XFORM_SYMBOL) && (resr.type != H5Z_XFORM_SYMBOL)) || ((resr.type == H5Z_XFORM_SYMBOL) && (resl.type != H5Z_XFORM_SYMBOL)))
{
if(array_type == H5T_NATIVE_CHAR)
- {
- char* charp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- charp = (char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- charp = (char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *charp++ -= tree_val;
-
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, char, -=, array_size)
else if(array_type == H5T_NATIVE_UCHAR)
- {
- unsigned char* ucharp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ucharp = (unsigned char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ucharp = (unsigned char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ucharp++ -= tree_val;
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned char, -=, array_size)
else if(array_type == H5T_NATIVE_SCHAR)
- {
- signed char* scharp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- scharp = (signed char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- scharp = (signed char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *scharp++ -= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, signed char, -=, array_size)
else if(array_type == H5T_NATIVE_SHORT)
- {
- short* shortp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- shortp = (short*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- shortp = (short*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *shortp++ -= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, short, -=, array_size)
else if(array_type == H5T_NATIVE_USHORT)
- {
- unsigned short* ushortp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ushortp = (unsigned short*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ushortp = (unsigned short*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ushortp++ -= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned short, -=, array_size)
else if(array_type == H5T_NATIVE_INT)
- {
- int* intp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- intp = (int*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- intp = (int*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *intp++ -= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, int, -=, array_size)
else if(array_type == H5T_NATIVE_UINT)
- {
- unsigned int* uintp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- uintp = (unsigned int*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- uintp = (unsigned int*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *uintp++ -= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned int, -=, array_size)
else if(array_type == H5T_NATIVE_LONG)
- {
- long* longp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- longp = (long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- longp = (long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *longp++ -= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, long, -=, array_size)
else if(array_type == H5T_NATIVE_ULONG)
- {
- unsigned long* ulongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ulongp = (unsigned long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ulongp = (unsigned long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ulongp++ -= tree_val;
-
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned long, -=, array_size)
else if(array_type == H5T_NATIVE_LLONG)
- {
- long_long* llongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- llongp = (long_long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- llongp = (long_long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *llongp++ -= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, long_long, -=, array_size)
else if(array_type == H5T_NATIVE_ULLONG)
- {
- unsigned long_long* ullongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ullongp = (unsigned long_long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ullongp = (unsigned long_long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ullongp++ -= tree_val;
- }
+ {
+#ifdef WIN32
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Cannot convert from unsigned int64 to double on win32")
+#else
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned long_long, -=, array_size)
+#endif
+ }
else if(array_type == H5T_NATIVE_FLOAT)
- {
- float* floatp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- floatp = (float*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- floatp = (float*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *floatp++ -= tree_val;
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, float, -=, array_size)
else if(array_type == H5T_NATIVE_DOUBLE)
- {
- double* doublep;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- doublep = (double*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- doublep = (double*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *doublep++ -= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, double, -=, array_size)
else if(array_type == H5T_NATIVE_LDOUBLE)
- {
- long double* ldoublep;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ldoublep = (long double*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ldoublep = (long double*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ldoublep++ -= tree_val;
- }
- }
- else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_SYMBOL))
- {
- if(array_type == H5T_NATIVE_CHAR)
- {
- char* charpl = (char*)resl.value.dat_val;
- char* charpr = (char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *charpl++ -= *charpr++;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, long double, -=, array_size)
+ }
+ else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_SYMBOL))
+ {
+ if(array_type == H5T_NATIVE_CHAR)
+ H5Z_XFORM_DO_OP2(resl, resr, char, -=, array_size)
else if(array_type == H5T_NATIVE_UCHAR)
- {
- unsigned char* ucharpl = (unsigned char*)resl.value.dat_val;
- unsigned char* ucharpr = (unsigned char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ucharpl++ -= *ucharpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned char, -=, array_size)
else if(array_type == H5T_NATIVE_SCHAR)
- {
- signed char* scharpl = (signed char*)resl.value.dat_val;
- signed char* scharpr = (signed char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *scharpl++ -= *scharpr++;
- }
- else if(array_type == H5T_NATIVE_INT)
- {
- int* intpl = (int*)resl.value.dat_val;
- int* intpr = (int*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *intpl++ -= *intpr++;
- }
- else if(array_type == H5T_NATIVE_UINT)
- {
- unsigned int* uintpl = (unsigned int*)resl.value.dat_val;
- unsigned int* uintpr = (unsigned int*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *uintpl++ -= *uintpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, signed char, -=, array_size)
else if(array_type == H5T_NATIVE_SHORT)
- {
- short* shortpl = (short*)resl.value.dat_val;
- short* shortpr = (short*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *shortpl++ -= *shortpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, short, -=, array_size)
else if(array_type == H5T_NATIVE_USHORT)
- {
- unsigned short* ushortpl = (unsigned short*)resl.value.dat_val;
- unsigned short* ushortpr = (unsigned short*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ushortpl++ -= *ushortpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned short, -=, array_size)
+ else if(array_type == H5T_NATIVE_INT)
+ H5Z_XFORM_DO_OP2(resl, resr, int, -=, array_size)
+ else if(array_type == H5T_NATIVE_UINT)
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned int, -=, array_size)
else if(array_type == H5T_NATIVE_LONG)
- {
- long* longpl = (long*)resl.value.dat_val;
- long* longpr = (long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *longpl++ -= *longpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, long, -=, array_size)
else if(array_type == H5T_NATIVE_ULONG)
- {
- unsigned long* ulongpl = (unsigned long*)resl.value.dat_val;
- unsigned long* ulongpr = (unsigned long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ulongpl++ -= *ulongpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned long, -=, array_size)
else if(array_type == H5T_NATIVE_LLONG)
- {
- long_long* llongpl = (long_long*)resl.value.dat_val;
- long_long* llongpr = (long_long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *llongpl++ -= *llongpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, long_long, -=, array_size)
else if(array_type == H5T_NATIVE_ULLONG)
- {
- unsigned long_long* ullongpl = (unsigned long_long*)resl.value.dat_val;
- unsigned long_long* ullongpr = (unsigned long_long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ullongpl++ -= *ullongpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned long_long, -=, array_size)
else if(array_type == H5T_NATIVE_FLOAT)
- {
- float* floatpl = (float*)resl.value.dat_val;
- float* floatpr = (float*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *floatpl++ -= *floatpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, float, -=, array_size)
else if(array_type == H5T_NATIVE_DOUBLE)
- {
- double* doublepl = (double*)resl.value.dat_val;
- double* doublepr = (double*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *doublepl++ -= *doublepr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, double, -=, array_size)
else if(array_type == H5T_NATIVE_LDOUBLE)
- {
- long double* ldoublepl = (long double*)resl.value.dat_val;
- long double* ldoublepr = (long double*)resr.value.dat_val;
+ H5Z_XFORM_DO_OP2(resl, resr, long double, -=, array_size)
+ }
- for(i=0; i<array_size; i++)
- *ldoublepl++ -= *ldoublepr++;
- }
- }
+
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation")
break;
@@ -1757,405 +1131,73 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_
if( ((resl.type == H5Z_XFORM_SYMBOL) && (resr.type != H5Z_XFORM_SYMBOL)) || ((resr.type == H5Z_XFORM_SYMBOL) && (resl.type != H5Z_XFORM_SYMBOL)))
{
if(array_type == H5T_NATIVE_CHAR)
- {
- char* charp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- charp = (char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- charp = (char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *charp++ *= tree_val;
-
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, char, *=, array_size)
else if(array_type == H5T_NATIVE_UCHAR)
- {
- unsigned char* ucharp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ucharp = (unsigned char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ucharp = (unsigned char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ucharp++ *= tree_val;
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned char, *=, array_size)
else if(array_type == H5T_NATIVE_SCHAR)
- {
- signed char* scharp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- scharp = (signed char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- scharp = (signed char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *scharp++ *= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, signed char, *=, array_size)
+ else if(array_type == H5T_NATIVE_SHORT)
+ H5Z_XFORM_DO_OP1(resl, resr, short, *=, array_size)
+ else if(array_type == H5T_NATIVE_USHORT)
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned short, *=, array_size)
else if(array_type == H5T_NATIVE_INT)
- {
- int* intp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- intp = (int*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- intp = (int*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *intp++ *= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, int, *=, array_size)
else if(array_type == H5T_NATIVE_UINT)
- {
- unsigned int* uintp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- uintp = (unsigned int*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- uintp = (unsigned int*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *uintp++ *= tree_val;
- }
-
- else if(array_type == H5T_NATIVE_SHORT)
- {
- short* shortp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- shortp = (short*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- shortp = (short*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *shortp++ *= tree_val;
- }
-
- else if(array_type == H5T_NATIVE_USHORT)
- {
- unsigned short* ushortp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ushortp = (unsigned short*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ushortp = (unsigned short*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ushortp++ *= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned int, *=, array_size)
else if(array_type == H5T_NATIVE_LONG)
- {
- long* longp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- longp = (long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- longp = (long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *longp++ *= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, long, *=, array_size)
else if(array_type == H5T_NATIVE_ULONG)
- {
- unsigned long* ulongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ulongp = (unsigned long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ulongp = (unsigned long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ulongp++ *= tree_val;
-
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned long, *=, array_size)
else if(array_type == H5T_NATIVE_LLONG)
- {
- long_long* llongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- llongp = (long_long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- llongp = (long_long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *llongp++ *= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, long_long, *=, array_size)
else if(array_type == H5T_NATIVE_ULLONG)
- {
- unsigned long_long* ullongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ullongp = (unsigned long_long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ullongp = (unsigned long_long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ullongp++ *= tree_val;
- }
-
+ {
+#ifdef WIN32
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Cannot convert from unsigned int64 to double on win32")
+#else
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned long_long, *=, array_size)
+#endif
+ }
else if(array_type == H5T_NATIVE_FLOAT)
- {
- float* floatp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- floatp = (float*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- floatp = (float*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *floatp++ *= tree_val;
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, float, *=, array_size)
else if(array_type == H5T_NATIVE_DOUBLE)
- {
- double* doublep;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- doublep = (double*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- doublep = (double*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *doublep++ *= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, double, *=, array_size)
else if(array_type == H5T_NATIVE_LDOUBLE)
- {
- long double* ldoublep;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ldoublep = (long double*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ldoublep = (long double*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ldoublep++ *= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, long double, *=, array_size)
- }
+ }
else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_SYMBOL))
- {
+ {
if(array_type == H5T_NATIVE_CHAR)
- {
- char* charpl = (char*)resl.value.dat_val;
- char* charpr = (char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *charpl++ *= *charpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, char, *=, array_size)
else if(array_type == H5T_NATIVE_UCHAR)
- {
- unsigned char* ucharpl = (unsigned char*)resl.value.dat_val;
- unsigned char* ucharpr = (unsigned char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ucharpl++ *= *ucharpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned char, *=, array_size)
else if(array_type == H5T_NATIVE_SCHAR)
- {
- signed char* scharpl = (signed char*)resl.value.dat_val;
- signed char* scharpr = (signed char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *scharpl++ *= *scharpr++;
- }
- else if(array_type == H5T_NATIVE_SHORT)
- {
- short* shortpl = (short*)resl.value.dat_val;
- short* shortpr = (short*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *shortpl++ *= *shortpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, signed char, *=, array_size)
+ else if(array_type == H5T_NATIVE_SHORT)
+ H5Z_XFORM_DO_OP2(resl, resr, short, *=, array_size)
else if(array_type == H5T_NATIVE_USHORT)
- {
- unsigned short* ushortpl = (unsigned short*)resl.value.dat_val;
- unsigned short* ushortpr = (unsigned short*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ushortpl++ *= *ushortpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned short, *=, array_size)
else if(array_type == H5T_NATIVE_INT)
- {
- int* intpl = (int*)resl.value.dat_val;
- int* intpr = (int*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *intpl++ *= *intpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, int, *=, array_size)
else if(array_type == H5T_NATIVE_UINT)
- {
- unsigned int* uintpl = (unsigned int*)resl.value.dat_val;
- unsigned int* uintpr = (unsigned int*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *uintpl++ *= *uintpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned int, *=, array_size)
else if(array_type == H5T_NATIVE_LONG)
- {
- long* longpl = (long*)resl.value.dat_val;
- long* longpr = (long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *longpl++ *= *longpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, long, *=, array_size)
else if(array_type == H5T_NATIVE_ULONG)
- {
- unsigned long* ulongpl = (unsigned long*)resl.value.dat_val;
- unsigned long* ulongpr = (unsigned long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ulongpl++ *= *ulongpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned long, *=, array_size)
else if(array_type == H5T_NATIVE_LLONG)
- {
- long_long* llongpl = (long_long*)resl.value.dat_val;
- long_long* llongpr = (long_long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *llongpl++ *= *llongpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, long_long, *=, array_size)
else if(array_type == H5T_NATIVE_ULLONG)
- {
- unsigned long_long* ullongpl = (unsigned long_long*)resl.value.dat_val;
- unsigned long_long* ullongpr = (unsigned long_long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ullongpl++ *= *ullongpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned long_long, *=, array_size)
else if(array_type == H5T_NATIVE_FLOAT)
- {
- float* floatpl = (float*)resl.value.dat_val;
- float* floatpr = (float*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *floatpl++ *= *floatpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, float, *=, array_size)
else if(array_type == H5T_NATIVE_DOUBLE)
- {
- double* doublepl = (double*)resl.value.dat_val;
- double* doublepr = (double*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *doublepl++ *= *doublepr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, double, *=, array_size)
else if(array_type == H5T_NATIVE_LDOUBLE)
- {
- long double* ldoublepl = (long double*)resl.value.dat_val;
- long double* ldoublepr = (long double*)resr.value.dat_val;
+ H5Z_XFORM_DO_OP2(resl, resr, long double, *=, array_size)
- for(i=0; i<array_size; i++)
- *ldoublepl++ *= *ldoublepr++;
- }
-
- }
+ }
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation")
break;
@@ -2164,406 +1206,73 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_
if( ((resl.type == H5Z_XFORM_SYMBOL) && (resr.type != H5Z_XFORM_SYMBOL)) || ((resr.type == H5Z_XFORM_SYMBOL) && (resl.type != H5Z_XFORM_SYMBOL)))
{
if(array_type == H5T_NATIVE_CHAR)
- {
- char* charp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- charp = (char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- charp = (char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *charp++ /= tree_val;
-
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, char, /=, array_size)
else if(array_type == H5T_NATIVE_UCHAR)
- {
- unsigned char* ucharp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ucharp = (unsigned char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ucharp = (unsigned char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ucharp++ /= tree_val;
-
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned char, /=, array_size)
else if(array_type == H5T_NATIVE_SCHAR)
- {
- signed char* scharp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- scharp = (signed char*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- scharp = (signed char*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *scharp++ /= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, signed char, /=, array_size)
else if(array_type == H5T_NATIVE_SHORT)
- {
- short* shortp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- shortp = (short*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- shortp = (short*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *shortp++ /= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, short, /=, array_size)
else if(array_type == H5T_NATIVE_USHORT)
- {
- unsigned short* ushortp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ushortp = (unsigned short*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ushortp = (unsigned short*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ushortp++ /= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned short, /=, array_size)
else if(array_type == H5T_NATIVE_INT)
- {
- int* intp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- intp = (int*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- intp = (int*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *intp++ /= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, int, /=, array_size)
else if(array_type == H5T_NATIVE_UINT)
- {
- unsigned int* uintp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- uintp = (unsigned int*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- uintp = (unsigned int*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *uintp++ /= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned int, /=, array_size)
else if(array_type == H5T_NATIVE_LONG)
- {
- long* longp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- longp = (long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- longp = (long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *longp++ /= tree_val;
- }
-
-
+ H5Z_XFORM_DO_OP1(resl, resr, long, /=, array_size)
else if(array_type == H5T_NATIVE_ULONG)
- {
- unsigned long* ulongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ulongp = (unsigned long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ulongp = (unsigned long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ulongp++ /= tree_val;
-
-
- }
+ {
+#ifdef WIN32
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Cannot convert from unsigned int64 to double on win32")
+#else
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned long_long, /=, array_size)
+#endif
+ }
else if(array_type == H5T_NATIVE_LLONG)
- {
- long_long* llongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- llongp = (long_long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- llongp = (long_long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *llongp++ /= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, long_long, /=, array_size)
else if(array_type == H5T_NATIVE_ULLONG)
- {
- unsigned long_long* ullongp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ullongp = (unsigned long_long*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ullongp = (unsigned long_long*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ullongp++ /= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, unsigned long_long, /=, array_size)
else if(array_type == H5T_NATIVE_FLOAT)
- {
- float* floatp;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- floatp = (float*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- floatp = (float*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *floatp++ /= tree_val;
-
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, float, /=, array_size)
else if(array_type == H5T_NATIVE_DOUBLE)
- {
- double* doublep;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- doublep = (double*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- doublep = (double*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *doublep++ /= tree_val;
- }
+ H5Z_XFORM_DO_OP1(resl, resr, double, /=, array_size)
else if(array_type == H5T_NATIVE_LDOUBLE)
- {
- long double* ldoublep;
- double tree_val;
-
- if(resl.type == H5Z_XFORM_SYMBOL)
- {
- tree_val = resr.type==H5Z_XFORM_INTEGER ? resr.value.int_val : resr.value.float_val;
- ldoublep = (long double*)resl.value.dat_val;
- }
- else
- {
- tree_val = resl.type==H5Z_XFORM_INTEGER ? resl.value.int_val : resl.value.float_val;
- ldoublep = (long double*)resr.value.dat_val;
- }
-
- for(i=0; i<array_size; i++)
- *ldoublep++ /= tree_val;
- }
-
+ H5Z_XFORM_DO_OP1(resl, resr, long double, /=, array_size)
+
}
else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_SYMBOL))
- {
+ {
if(array_type == H5T_NATIVE_CHAR)
- {
- char* charpl = (char*)resl.value.dat_val;
- char* charpr = (char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *charpl++ /= *charpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, char, /=, array_size)
else if(array_type == H5T_NATIVE_UCHAR)
- {
- unsigned char* ucharpl = (unsigned char*)resl.value.dat_val;
- unsigned char* ucharpr = (unsigned char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ucharpl++ /= *ucharpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned char, /=, array_size)
else if(array_type == H5T_NATIVE_SCHAR)
- {
- signed char* scharpl = (signed char*)resl.value.dat_val;
- signed char* scharpr = (signed char*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *scharpl++ /= *scharpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, signed char, /=, array_size)
else if(array_type == H5T_NATIVE_SHORT)
- {
- short* shortpl = (short*)resl.value.dat_val;
- short* shortpr = (short*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *shortpl++ /= *shortpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, short, /=, array_size)
else if(array_type == H5T_NATIVE_USHORT)
- {
- unsigned short* ushortpl = (unsigned short*)resl.value.dat_val;
- unsigned short* ushortpr = (unsigned short*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ushortpl++ /= *ushortpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned short, /=, array_size)
else if(array_type == H5T_NATIVE_INT)
- {
- int* intpl = (int*)resl.value.dat_val;
- int* intpr = (int*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *intpl++ /= *intpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, int, /=, array_size)
else if(array_type == H5T_NATIVE_UINT)
- {
- unsigned int* uintpl = (unsigned int*)resl.value.dat_val;
- unsigned int* uintpr = (unsigned int*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *uintpl++ /= *uintpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned int, /=, array_size)
else if(array_type == H5T_NATIVE_LONG)
- {
- long* longpl = (long*)resl.value.dat_val;
- long* longpr = (long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *longpl++ /= *longpr++;
- }
-
-
+ H5Z_XFORM_DO_OP2(resl, resr, long, /=, array_size)
else if(array_type == H5T_NATIVE_ULONG)
- {
- unsigned long* ulongpl = (unsigned long*)resl.value.dat_val;
- unsigned long* ulongpr = (unsigned long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ulongpl++ /= *ulongpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned long, /=, array_size)
else if(array_type == H5T_NATIVE_LLONG)
- {
- long_long* llongpl = (long_long*)resl.value.dat_val;
- long_long* llongpr = (long_long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *llongpl++ /= *llongpr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, long_long, /=, array_size)
else if(array_type == H5T_NATIVE_ULLONG)
- {
- unsigned long_long* ullongpl = (unsigned long_long*)resl.value.dat_val;
- unsigned long_long* ullongpr = (unsigned long_long*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ullongpl++ /= *ullongpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, unsigned long_long, /=, array_size)
else if(array_type == H5T_NATIVE_FLOAT)
- {
- float* floatpl = (float*)resl.value.dat_val;
- float* floatpr = (float*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *floatpl++ /= *floatpr++;
- }
-
+ H5Z_XFORM_DO_OP2(resl, resr, float, /=, array_size)
else if(array_type == H5T_NATIVE_DOUBLE)
- {
- double* doublepl = (double*)resl.value.dat_val;
- double* doublepr = (double*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *doublepl++ /= *doublepr++;
- }
+ H5Z_XFORM_DO_OP2(resl, resr, double, /=, array_size)
else if(array_type == H5T_NATIVE_LDOUBLE)
- {
- long double* ldoublepl = (long double*)resl.value.dat_val;
- long double* ldoublepr = (long double*)resr.value.dat_val;
-
- for(i=0; i<array_size; i++)
- *ldoublepl++ /= *ldoublepr++;
- }
-
- }
+ H5Z_XFORM_DO_OP2(resl, resr, long double, /=, array_size)
+
+ }
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation")
break;
@@ -2731,49 +1440,14 @@ void* H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z
}
}
else if(tree->type == H5Z_XFORM_MULT)
- {
- if ((ret_value = (H5Z_node*) H5MM_malloc(sizeof(H5Z_node))) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree")
- else
- {
- ret_value->type = H5Z_XFORM_MULT;
- ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers);
- ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers);
- }
- }
+ H5Z_XFORM_DO_OP4(H5Z_XFORM_MULT)
else if(tree->type == H5Z_XFORM_PLUS)
- {
- if ((ret_value = (H5Z_node*) H5MM_malloc(sizeof(H5Z_node))) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree")
- else
- {
- ret_value->type = H5Z_XFORM_PLUS;
- ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers);
- ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers);
- }
- }
+ H5Z_XFORM_DO_OP4(H5Z_XFORM_PLUS)
else if(tree->type == H5Z_XFORM_MINUS)
- {
- if ((ret_value = (H5Z_node*) H5MM_malloc(sizeof(H5Z_node))) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree")
- else
- {
- ret_value->type = H5Z_XFORM_MINUS;
- ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers);
- ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers);
- }
- }
+ H5Z_XFORM_DO_OP4(H5Z_XFORM_MINUS)
else if(tree->type == H5Z_XFORM_DIVIDE)
- {
- if ((ret_value = (H5Z_node*) H5MM_malloc(sizeof(H5Z_node))) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree")
- else
- {
- ret_value->type = H5Z_XFORM_DIVIDE;
- ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers);
- ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers);
- }
- }
+ H5Z_XFORM_DO_OP4(H5Z_XFORM_DIVIDE)
+
else
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error in parse tree while trying to copy")
@@ -2853,99 +1527,13 @@ static void H5Z_do_op(H5Z_node* tree)
if(tree->type == H5Z_XFORM_DIVIDE)
- {
- if((tree->lchild->type == H5Z_XFORM_INTEGER) && (tree->rchild->type==H5Z_XFORM_INTEGER))
- {
- tree->type = H5Z_XFORM_INTEGER;
- tree->value.int_val = tree->lchild->value.int_val / tree->rchild->value.int_val;
- H5MM_xfree(tree->lchild);
- H5MM_xfree(tree->rchild);
- tree->lchild = NULL;
- tree->rchild = NULL;
- }
- else if( ( (tree->lchild->type == H5Z_XFORM_FLOAT) || (tree->lchild->type == H5Z_XFORM_INTEGER)) && ( (tree->rchild->type == H5Z_XFORM_FLOAT) || (tree->rchild->type == H5Z_XFORM_INTEGER)))
- {
- tree->type = H5Z_XFORM_FLOAT;
- tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : tree->lchild->value.int_val) /
- ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : tree->rchild->value.int_val);
- H5MM_xfree(tree->lchild);
- H5MM_xfree(tree->rchild);
- tree->lchild = NULL;
- tree->rchild = NULL;
- }
- }
+ H5Z_XFORM_DO_OP3(/)
else if(tree->type == H5Z_XFORM_MULT)
- {
-
-
- if((tree->lchild->type == H5Z_XFORM_INTEGER) && (tree->rchild->type==H5Z_XFORM_INTEGER))
- {
- tree->type = H5Z_XFORM_INTEGER;
- tree->value.int_val = tree->lchild->value.int_val * tree->rchild->value.int_val;
- H5MM_xfree(tree->lchild);
- H5MM_xfree(tree->rchild);
- tree->lchild = NULL;
- tree->rchild = NULL;
- }
- else if( ( (tree->lchild->type == H5Z_XFORM_FLOAT) || (tree->lchild->type == H5Z_XFORM_INTEGER)) && ( (tree->rchild->type == H5Z_XFORM_FLOAT) || (tree->rchild->type == H5Z_XFORM_INTEGER)))
- {
- tree->type = H5Z_XFORM_FLOAT;
- tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : tree->lchild->value.int_val) *
- ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : tree->rchild->value.int_val);
- H5MM_xfree(tree->lchild);
- H5MM_xfree(tree->rchild);
- tree->lchild = NULL;
- tree->rchild = NULL;
- }
- }
+ H5Z_XFORM_DO_OP3(*)
else if(tree->type == H5Z_XFORM_PLUS)
- {
-
-
- if((tree->lchild->type == H5Z_XFORM_INTEGER) && (tree->rchild->type==H5Z_XFORM_INTEGER))
- {
- tree->type = H5Z_XFORM_INTEGER;
- tree->value.int_val = tree->lchild->value.int_val + tree->rchild->value.int_val;
- H5MM_xfree(tree->lchild);
- H5MM_xfree(tree->rchild);
- tree->lchild = NULL;
- tree->rchild = NULL;
- }
- else if( ( (tree->lchild->type == H5Z_XFORM_FLOAT) || (tree->lchild->type == H5Z_XFORM_INTEGER)) && ( (tree->rchild->type == H5Z_XFORM_FLOAT) || (tree->rchild->type == H5Z_XFORM_INTEGER)))
- {
- tree->type = H5Z_XFORM_FLOAT;
- tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : tree->lchild->value.int_val) +
- ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : tree->rchild->value.int_val);
- H5MM_xfree(tree->lchild);
- H5MM_xfree(tree->rchild);
- tree->lchild = NULL;
- tree->rchild = NULL;
- }
- }
+ H5Z_XFORM_DO_OP3(+)
else if(tree->type == H5Z_XFORM_MINUS)
- {
-
-
- if((tree->lchild->type == H5Z_XFORM_INTEGER) && (tree->rchild->type==H5Z_XFORM_INTEGER))
- {
- tree->type = H5Z_XFORM_INTEGER;
- tree->value.int_val = tree->lchild->value.int_val - tree->rchild->value.int_val;
- H5MM_xfree(tree->lchild);
- H5MM_xfree(tree->rchild);
- tree->lchild = NULL;
- tree->rchild = NULL;
- }
- else if( ( (tree->lchild->type == H5Z_XFORM_FLOAT) || (tree->lchild->type == H5Z_XFORM_INTEGER)) && ( (tree->rchild->type == H5Z_XFORM_FLOAT) || (tree->rchild->type == H5Z_XFORM_INTEGER)))
- {
- tree->type = H5Z_XFORM_FLOAT;
- tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : tree->lchild->value.int_val) -
- ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : tree->rchild->value.int_val);
- H5MM_xfree(tree->lchild);
- H5MM_xfree(tree->rchild);
- tree->lchild = NULL;
- tree->rchild = NULL;
- }
- }
+ H5Z_XFORM_DO_OP3(-)
FUNC_LEAVE_NOAPI_VOID;