Commit 14f8269e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

transpose2dArray: wrong result (bug fix)

parent c55d657a
2014-11-12 Uwe Schulzweida
* Version 1.6.5.2 released
2014-11-12 Uwe Schulzweida
* transpose2dArrayXX: wrong result (bug fix)
2014-11-08 Uwe Schulzweida
* cgribexScanTimestep1: set flag to 0 in call to cgribexVarCompare() (bug fix)
......@@ -47,7 +55,7 @@
2014-08-21 Uwe Schulzweida
* reshGetElem: call show_stackframe() to print a backtrace
* reshGetElem: call show_stackframe() to print a backtrace
2014-08-20 Uwe Schulzweida
......
......@@ -4030,15 +4030,23 @@ int set_validrangeSP(long gridsize, float *data, double missval, double validmin
#endif
#if defined (HAVE_LIBNETCDF)
/*
static
size_t min_size(size_t a, size_t b)
{
return a < b ? a : b;
}
*/
static
void transpose2dArrayDP(size_t inWidth, size_t inHeight, double* data)
{
double *temp = (double *) malloc(inWidth*inHeight*sizeof(double));
memcpy(temp, data, inWidth*inHeight*sizeof(double));
for ( size_t j = 0; j < inHeight; ++j )
for ( size_t i = 0; i < inWidth; ++i )
data[j*inWidth+i] = temp[i*inHeight+j];
free(temp);
/*
const size_t cacheBlockSize = 32; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks,
// which should be a decent compromise on many architectures.
double (*temp)[inWidth] = malloc(inHeight*sizeof(*temp));
......@@ -4058,11 +4066,19 @@ void transpose2dArrayDP(size_t inWidth, size_t inHeight, double* data)
}
}
free(temp);
*/
}
static
void transpose2dArraySP(size_t inWidth, size_t inHeight, float* data)
{
float *temp = (float *) malloc(inWidth*inHeight*sizeof(float));
memcpy(temp, data, inWidth*inHeight*sizeof(float));
for ( size_t j = 0; j < inHeight; ++j )
for ( size_t i = 0; i < inWidth; ++i )
data[j*inWidth+i] = temp[i*inHeight+j];
free(temp);
/*
const size_t cacheBlockSize = 32; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks,
// which should be a decent compromise on many architectures.
float (*temp)[inWidth] = malloc(inHeight*sizeof(*temp));
......@@ -4082,6 +4098,7 @@ void transpose2dArraySP(size_t inWidth, size_t inHeight, float* data)
}
}
free(temp);
*/
}
static
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment