Commit 1792dbba authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cgribexlib.c update.

parent da19d9fb
2017-03-24 Uwe Schulzweida
* using CGRIBEX library version 1.8.0
* Version 1.8.1 released
2017-04-10 Uwe Schulzweida
......
/* Automatically generated by m214003 at 2016-12-20, do not edit */
/* Automatically generated by m214003 at 2017-04-12, do not edit */
/* CGRIBEXLIB_VERSION="1.7.6" */
/* CGRIBEXLIB_VERSION="1.8.0" */
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) || defined (__clang__)
#pragma GCC diagnostic push
......@@ -31,8 +31,8 @@
#include "calendar.h"
#include "timebase.h"
#ifndef _TEMPLATES_H
#define _TEMPLATES_H
#ifndef CGRIBEX_TEMPLATES_H
#define CGRIBEX_TEMPLATES_H
#define CAT(X,Y) X##_##Y
#define TEMPLATE(X,Y) CAT(X,Y)
......@@ -51,13 +51,13 @@
#include <float.h>
#if ! defined (_CGRIBEX_H)
#if ! defined (CGRIBEX_H)
# include "cgribex.h"
#endif
#if ! defined (ERROR_H)
# include "error.h"
#endif
#if ! defined (_DTYPES_H)
#if ! defined (DTYPES_H)
# include "dtypes.h"
#endif
......@@ -223,8 +223,8 @@ int grib2Sections(unsigned char *gribbuffer, long gribbufsize, unsigned char **i
#endif
#endif /* GRIB_INT_H */
#ifndef _GRIBDECODE_H
#define _GRIBDECODE_H
#ifndef GRIBDECODE_H
#define GRIBDECODE_H
#define UNDEFINED 9.999e20
......@@ -363,9 +363,9 @@ int grib2Sections(unsigned char *gribbuffer, long gribbufsize, unsigned char **i
#define GRIB2_SECLEN(section) (GET_UINT4(section[0], section[1], section[2], section[3]))
#define GRIB2_SECNUM(section) (GET_UINT1(section[4]))
#endif /* _GRIBDECODE_H */
#ifndef _GRIB_ENCODE_H
#define _GRIB_ENCODE_H
#endif /* GRIBDECODE_H */
#ifndef CGRIBEX_GRIB_ENCODE_H
#define CGRIBEX_GRIB_ENCODE_H
#include <limits.h>
......@@ -402,7 +402,7 @@ enum {
Put3Byte(mantissa); \
}
#endif /* _GRIB_ENCODE_H */
#endif /* CGRIBEX_GRIB_ENCODE_H */
#ifndef CODEC_COMMON_H
#define CODEC_COMMON_H
#define gribSwapByteOrder_uint16(ui16) ((uint16_t)((ui16<<8) | (ui16>>8)))
......@@ -11402,6 +11402,9 @@ void encodePDS(GRIBPACK *lpds, long pdsLen, int *isec1)
#ifdef T
#define round_float roundf
#define round_double round
static
void TEMPLATE(encode_array_common,T)(int numBits, size_t packStart, size_t datasize, GRIBPACK *lGrib,
const T *data, T zref, T factor, size_t *gz)
......@@ -11419,7 +11422,7 @@ void TEMPLATE(encode_array_common,T)(int numBits, size_t packStart, size_t datas
for ( i = packStart; i < datasize; i++ )
{
/* note float -> unsigned int .. truncate */
ival = (unsigned int) ((data[i] - zref) * factor + (T)0.5);
ival = (unsigned int)(TEMPLATE(round,T)((data[i] - zref) * factor));
/*
if ( ival > max_nbpv_pow2 ) ival = max_nbpv_pow2;
if ( ival < 0 ) ival = 0;
......@@ -11464,7 +11467,7 @@ void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib,
{
for ( size_t i = 0; i < datasize; i++ )
{
sgrib[i] = (uint16_t) ((data[i] - zref) * factor + (T)0.5);
sgrib[i] = (uint16_t)(TEMPLATE(round,T)((data[i] - zref) * factor));
}
}
else
......@@ -11472,7 +11475,7 @@ void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib,
uint16_t ui16;
for ( size_t i = 0; i < datasize; i++ )
{
ui16 = (uint16_t) ((data[i] - zref) * factor + (T)0.5);
ui16 = (uint16_t)(TEMPLATE(round,T)((data[i] - zref) * factor));
sgrib[i] = gribSwapByteOrder_uint16(ui16);
}
}
......@@ -11499,7 +11502,7 @@ void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib,
#endif
for ( i = 0; i < datasize; i++ )
{
tmp = ((data[i] - zref) * factor + (T)0.5);
tmp = TEMPLATE(round,T)((data[i] - zref) * factor);
ui16 = (uint16_t) tmp;
lGrib[z ] = ui16 >> 8;
lGrib[z+1] = ui16;
......@@ -11542,7 +11545,7 @@ void TEMPLATE(encode_array,T)(int numBits, size_t packStart, size_t datasize,
#endif
for ( i = 0; i < datasize; i++ )
{
tmp = ((data[i] - zref) * factor + (T)0.5);
tmp = TEMPLATE(round,T)((data[i] - zref) * factor);
lGrib[z ] = (GRIBPACK)tmp;
z++;
}
......@@ -11605,7 +11608,7 @@ void TEMPLATE(encode_array,T)(int numBits, size_t packStart, size_t datasize,
#endif
for ( i = 0; i < datasize; i++ )
{
tmp = ((data[i] - zref) * factor + (T)0.5);
tmp = TEMPLATE(round,T)((data[i] - zref) * factor);
ui32 = (uint32_t) tmp;
lGrib[z ] = (GRIBPACK)(ui32 >> 16);
lGrib[z+1] = (GRIBPACK)(ui32 >> 8);
......@@ -11634,7 +11637,7 @@ void TEMPLATE(encode_array,T)(int numBits, size_t packStart, size_t datasize,
#endif
for ( i = 0; i < datasize; i++ )
{
tmp = ((data[i] - zref) * factor + (T)0.5);
tmp = TEMPLATE(round,T)((data[i] - zref) * factor);
ui32 = (uint32_t) tmp;
lGrib[z ] = (GRIBPACK)(ui32 >> 24);
lGrib[z+1] = (GRIBPACK)(ui32 >> 16);
......@@ -11671,17 +11674,17 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
U_BYTEORDER;
size_t i, j, z = *gz;
#ifdef _ARCH_PWR6
#define __UNROLL_DEPTH_2 8
enum { CGRIBEX__UNROLL_DEPTH_2 = 8 };
#else
#define __UNROLL_DEPTH_2 128
enum { CGRIBEX__UNROLL_DEPTH_2 = 128 };
#endif
size_t residual;
size_t ofs;
T dval[__UNROLL_DEPTH_2];
T dval[CGRIBEX__UNROLL_DEPTH_2];
data += packStart;
datasize -= packStart;
residual = datasize % __UNROLL_DEPTH_2;
residual = datasize % CGRIBEX__UNROLL_DEPTH_2;
ofs = datasize - residual;
// reducing FP operations to single FMA is slowing down on pwr6 ...
......@@ -11692,13 +11695,13 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
hpmStart(2, "pack 8 bit unrolled");
#endif
unsigned char *cgrib = (unsigned char *) (lGrib + z);
for ( i = 0; i < datasize - residual; i += __UNROLL_DEPTH_2 )
for ( i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2 )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
dval[j] = ((data[i+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[i+j] - zref) * factor);
}
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
#ifdef _ARCH_PWR6
*cgrib++ = (unsigned long) dval[j];
......@@ -11706,11 +11709,11 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
*cgrib++ = (unsigned char) dval[j];
#endif
}
z += __UNROLL_DEPTH_2;
z += CGRIBEX__UNROLL_DEPTH_2;
}
for (j = 0; j < residual; j++)
{
dval[j] = ((data[ofs+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[ofs+j] - zref) * factor);
}
for (j = 0; j < residual; j++)
{
......@@ -11738,15 +11741,15 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
#endif
uint16_t *sgrib = (uint16_t *) (lGrib+z);
for ( i = 0; i < datasize - residual; i += __UNROLL_DEPTH_2 )
for ( i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2 )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
dval[j] = ((data[i+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[i+j] - zref) * factor);
}
if ( IS_BIGENDIAN() )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
#ifdef _ARCH_PWR6
*sgrib++ = (unsigned long) dval[j];
......@@ -11754,21 +11757,21 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
*sgrib++ = (uint16_t) dval[j];
#endif
}
z += 2*__UNROLL_DEPTH_2;
z += 2*CGRIBEX__UNROLL_DEPTH_2;
}
else
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
ival = (uint16_t) dval[j];
*sgrib++ = gribSwapByteOrder_uint16(ival);
}
z += 2*__UNROLL_DEPTH_2;
z += 2*CGRIBEX__UNROLL_DEPTH_2;
}
}
for (j = 0; j < residual; j++)
{
dval[j] = ((data[ofs+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[ofs+j] - zref) * factor);
}
if ( IS_BIGENDIAN() )
{
......@@ -11806,13 +11809,13 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
#else
uint32_t ival;
#endif
for ( i = 0; i < datasize - residual; i += __UNROLL_DEPTH_2 )
for ( i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2 )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
dval[j] = ((data[i+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[i+j] - zref) * factor);
}
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
#ifdef _ARCH_PWR6
ival = (unsigned long) dval[j];
......@@ -11827,7 +11830,7 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
}
for (j = 0; j < residual; j++)
{
dval[j] = ((data[ofs+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[ofs+j] - zref) * factor);
}
for (j = 0; j < residual; j++)
{
......@@ -11852,15 +11855,15 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
uint32_t ival;
#endif
unsigned int *igrib = (unsigned int *) (lGrib + z);
for ( i = 0; i < datasize - residual; i += __UNROLL_DEPTH_2 )
for ( i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2 )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
dval[j] = ((data[i+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[i+j] - zref) * factor);
}
if ( IS_BIGENDIAN() )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
#ifdef _ARCH_PWR6
*igrib = (unsigned long) dval[j];
......@@ -11873,7 +11876,7 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
}
else
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
ival = (uint32_t) dval[j];
lGrib[z ] = (GRIBPACK)(ival >> 24);
......@@ -11886,7 +11889,7 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
}
for (j = 0; j < residual; j++)
{
dval[j] = ((data[ofs+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[ofs+j] - zref) * factor);
}
if ( IS_BIGENDIAN() )
{
......@@ -11930,7 +11933,6 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
}
*gz = z;
#undef __UNROLL_DEPTH_2
}
#endif /* T */
......@@ -11948,6 +11950,9 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
#ifdef T
#define round_float roundf
#define round_double round
static
void TEMPLATE(encode_array_common,T)(int numBits, size_t packStart, size_t datasize, GRIBPACK *lGrib,
const T *data, T zref, T factor, size_t *gz)
......@@ -11965,7 +11970,7 @@ void TEMPLATE(encode_array_common,T)(int numBits, size_t packStart, size_t datas
for ( i = packStart; i < datasize; i++ )
{
/* note float -> unsigned int .. truncate */
ival = (unsigned int) ((data[i] - zref) * factor + (T)0.5);
ival = (unsigned int)(TEMPLATE(round,T)((data[i] - zref) * factor));
/*
if ( ival > max_nbpv_pow2 ) ival = max_nbpv_pow2;
if ( ival < 0 ) ival = 0;
......@@ -12010,7 +12015,7 @@ void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib,
{
for ( size_t i = 0; i < datasize; i++ )
{
sgrib[i] = (uint16_t) ((data[i] - zref) * factor + (T)0.5);
sgrib[i] = (uint16_t)(TEMPLATE(round,T)((data[i] - zref) * factor));
}
}
else
......@@ -12018,7 +12023,7 @@ void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib,
uint16_t ui16;
for ( size_t i = 0; i < datasize; i++ )
{
ui16 = (uint16_t) ((data[i] - zref) * factor + (T)0.5);
ui16 = (uint16_t)(TEMPLATE(round,T)((data[i] - zref) * factor));
sgrib[i] = gribSwapByteOrder_uint16(ui16);
}
}
......@@ -12045,7 +12050,7 @@ void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib,
#endif
for ( i = 0; i < datasize; i++ )
{
tmp = ((data[i] - zref) * factor + (T)0.5);
tmp = TEMPLATE(round,T)((data[i] - zref) * factor);
ui16 = (uint16_t) tmp;
lGrib[z ] = ui16 >> 8;
lGrib[z+1] = ui16;
......@@ -12088,7 +12093,7 @@ void TEMPLATE(encode_array,T)(int numBits, size_t packStart, size_t datasize,
#endif
for ( i = 0; i < datasize; i++ )
{
tmp = ((data[i] - zref) * factor + (T)0.5);
tmp = TEMPLATE(round,T)((data[i] - zref) * factor);
lGrib[z ] = (GRIBPACK)tmp;
z++;
}
......@@ -12151,7 +12156,7 @@ void TEMPLATE(encode_array,T)(int numBits, size_t packStart, size_t datasize,
#endif
for ( i = 0; i < datasize; i++ )
{
tmp = ((data[i] - zref) * factor + (T)0.5);
tmp = TEMPLATE(round,T)((data[i] - zref) * factor);
ui32 = (uint32_t) tmp;
lGrib[z ] = (GRIBPACK)(ui32 >> 16);
lGrib[z+1] = (GRIBPACK)(ui32 >> 8);
......@@ -12180,7 +12185,7 @@ void TEMPLATE(encode_array,T)(int numBits, size_t packStart, size_t datasize,
#endif
for ( i = 0; i < datasize; i++ )
{
tmp = ((data[i] - zref) * factor + (T)0.5);
tmp = TEMPLATE(round,T)((data[i] - zref) * factor);
ui32 = (uint32_t) tmp;
lGrib[z ] = (GRIBPACK)(ui32 >> 24);
lGrib[z+1] = (GRIBPACK)(ui32 >> 16);
......@@ -12217,17 +12222,17 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
U_BYTEORDER;
size_t i, j, z = *gz;
#ifdef _ARCH_PWR6
#define __UNROLL_DEPTH_2 8
enum { CGRIBEX__UNROLL_DEPTH_2 = 8 };
#else
#define __UNROLL_DEPTH_2 128
enum { CGRIBEX__UNROLL_DEPTH_2 = 128 };
#endif
size_t residual;
size_t ofs;
T dval[__UNROLL_DEPTH_2];
T dval[CGRIBEX__UNROLL_DEPTH_2];
data += packStart;
datasize -= packStart;
residual = datasize % __UNROLL_DEPTH_2;
residual = datasize % CGRIBEX__UNROLL_DEPTH_2;
ofs = datasize - residual;
// reducing FP operations to single FMA is slowing down on pwr6 ...
......@@ -12238,13 +12243,13 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
hpmStart(2, "pack 8 bit unrolled");
#endif
unsigned char *cgrib = (unsigned char *) (lGrib + z);
for ( i = 0; i < datasize - residual; i += __UNROLL_DEPTH_2 )
for ( i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2 )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
dval[j] = ((data[i+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[i+j] - zref) * factor);
}
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
#ifdef _ARCH_PWR6
*cgrib++ = (unsigned long) dval[j];
......@@ -12252,11 +12257,11 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
*cgrib++ = (unsigned char) dval[j];
#endif
}
z += __UNROLL_DEPTH_2;
z += CGRIBEX__UNROLL_DEPTH_2;
}
for (j = 0; j < residual; j++)
{
dval[j] = ((data[ofs+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[ofs+j] - zref) * factor);
}
for (j = 0; j < residual; j++)
{
......@@ -12284,15 +12289,15 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
#endif
uint16_t *sgrib = (uint16_t *) (lGrib+z);
for ( i = 0; i < datasize - residual; i += __UNROLL_DEPTH_2 )
for ( i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2 )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
dval[j] = ((data[i+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[i+j] - zref) * factor);
}
if ( IS_BIGENDIAN() )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
#ifdef _ARCH_PWR6
*sgrib++ = (unsigned long) dval[j];
......@@ -12300,21 +12305,21 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
*sgrib++ = (uint16_t) dval[j];
#endif
}
z += 2*__UNROLL_DEPTH_2;
z += 2*CGRIBEX__UNROLL_DEPTH_2;
}
else
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
ival = (uint16_t) dval[j];
*sgrib++ = gribSwapByteOrder_uint16(ival);
}
z += 2*__UNROLL_DEPTH_2;
z += 2*CGRIBEX__UNROLL_DEPTH_2;
}
}
for (j = 0; j < residual; j++)
{
dval[j] = ((data[ofs+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[ofs+j] - zref) * factor);
}
if ( IS_BIGENDIAN() )
{
......@@ -12352,13 +12357,13 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
#else
uint32_t ival;
#endif
for ( i = 0; i < datasize - residual; i += __UNROLL_DEPTH_2 )
for ( i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2 )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
dval[j] = ((data[i+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[i+j] - zref) * factor);
}
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
#ifdef _ARCH_PWR6
ival = (unsigned long) dval[j];
......@@ -12373,7 +12378,7 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
}
for (j = 0; j < residual; j++)
{
dval[j] = ((data[ofs+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[ofs+j] - zref) * factor);
}
for (j = 0; j < residual; j++)
{
......@@ -12398,15 +12403,15 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
uint32_t ival;
#endif
unsigned int *igrib = (unsigned int *) (lGrib + z);
for ( i = 0; i < datasize - residual; i += __UNROLL_DEPTH_2 )
for ( i = 0; i < datasize - residual; i += CGRIBEX__UNROLL_DEPTH_2 )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
dval[j] = ((data[i+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[i+j] - zref) * factor);
}
if ( IS_BIGENDIAN() )
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
#ifdef _ARCH_PWR6
*igrib = (unsigned long) dval[j];
......@@ -12419,7 +12424,7 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
}
else
{
for (j = 0; j < __UNROLL_DEPTH_2; j++)
for (j = 0; j < CGRIBEX__UNROLL_DEPTH_2; j++)
{
ival = (uint32_t) dval[j];
lGrib[z ] = (GRIBPACK)(ival >> 24);
......@@ -12432,7 +12437,7 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
}
for (j = 0; j < residual; j++)
{
dval[j] = ((data[ofs+j] - zref) * factor + (T)0.5);
dval[j] = TEMPLATE(round,T)((data[ofs+j] - zref) * factor);
}
if ( IS_BIGENDIAN() )
{
......@@ -12476,7 +12481,6 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat
}
*gz = z;
#undef __UNROLL_DEPTH_2
}
#endif /* T */
......@@ -13711,7 +13715,7 @@ void encode_dummy(void)
(void) encode_array_unrolled_double(0, 0, 0, NULL, NULL, 0, 0, NULL);
(void) encode_array_unrolled_float(0, 0, 0, NULL, NULL, 0, 0, NULL);
}
static const char grb_libvers[] = "1.7.6" " of ""Dec 20 2016"" ""19:55:24";
static const char grb_libvers[] = "1.8.0" " of ""Apr 12 2017"" ""10:21:00";
const char *
cgribexLibraryVersion(void)
{
......
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