Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
da5fa937
Commit
da5fa937
authored
May 28, 2014
by
Uwe Schulzweida
Browse files
cgribexlib update
parent
c0d2498d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cgribexlib.c
View file @
da5fa937
/* Automatically generated by m214003 at 2014-0
3
-28, do not edit */
/* Automatically generated by m214003 at 2014-0
5
-28, do not edit */
/* CGRIBEXLIB_VERSION="1.6.4" */
...
...
@@ -175,9 +175,9 @@ long packInt32(unsigned INT32 *up, unsigned char *cp, long bc, long tc);
#endif
long
packInt64
(
unsigned
INT64
*
up
,
unsigned
char
*
cp
,
long
bc
,
long
tc
);
#if defined (INT32)
long
unpackInt32
(
unsigned
char
*
cp
,
unsigned
INT32
*
up
,
long
bc
,
long
tc
);
long
unpackInt32
(
const
unsigned
char
*
cp
,
unsigned
INT32
*
up
,
long
bc
,
long
tc
);
#endif
long
unpackInt64
(
unsigned
char
*
cp
,
unsigned
INT64
*
up
,
long
bc
,
long
tc
);
long
unpackInt64
(
const
unsigned
char
*
cp
,
unsigned
INT64
*
up
,
long
bc
,
long
tc
);
void
gribEncode
(
int
*
isec0
,
int
*
isec1
,
int
*
isec2
,
double
*
fsec2
,
int
*
isec3
,
double
*
fsec3
,
int
*
isec4
,
double
*
fsec4
,
int
klenp
,
int
*
kgrib
,
...
...
@@ -1091,7 +1091,7 @@ int main(void)
printf
(
"gcc
\n
"
);
#endif
data
=
malloc
(
datasize
*
sizeof
(
double
));
data
=
(
double
*
)
malloc
(
datasize
*
sizeof
(
double
));
for
(
long
i
=
datasize
-
1
;
i
>=
0
;
i
--
)
data
[
i
]
=
(
double
)
(
-
datasize
/
2
+
i
);
...
...
@@ -1362,7 +1362,7 @@ void sse41_encode_double_array_2byte(size_t datasize,
for
(
i
=
0
;
i
<
(
datasize
-
residual
);
i
+=
16
)
{
(
void
)
_mm_prefetch
(
dval
+
8
,
_MM_HINT_NTA
);
(
void
)
_mm_prefetch
(
(
const
char
*
)(
dval
+
8
)
,
_MM_HINT_NTA
);
//_____________________________________________________________________________
d0
=
_mm_loadu_pd
(
dval
);
...
...
@@ -1403,7 +1403,7 @@ void sse41_encode_double_array_2byte(size_t datasize,
//_____________________________________________________________________________
(
void
)
_mm_prefetch
(
dval
+
16
,
_MM_HINT_NTA
);
(
void
)
_mm_prefetch
(
(
const
char
*
)(
dval
+
16
)
,
_MM_HINT_NTA
);
//_____________________________________________________________________________
...
...
@@ -1951,8 +1951,8 @@ int main(void)
double
t_begin
,
t_end
;
unsigned
char
*
lgrib
;
data
=
malloc
(
datasize
*
sizeof
(
double
));
lgrib
=
malloc
(
2
*
datasize
*
sizeof
(
unsigned
char
));
data
=
(
double
*
)
malloc
(
datasize
*
sizeof
(
double
));
lgrib
=
(
unsigned
char
*
)
malloc
(
2
*
datasize
*
sizeof
(
unsigned
char
));
for
(
long
i
=
0
;
i
<
datasize
;
++
i
)
data
[
i
]
=
(
double
)
(
-
datasize
/
2
+
i
);
...
...
@@ -2319,8 +2319,8 @@ void decode_double_array_common2(const unsigned char * restrict igrib, long jlen
}
static
void
decode_double_array_byte
(
const
unsigned
char
*
restrict
igrib
,
long
jlend
,
int
numBits
,
double
fmin
,
double
zscale
,
double
*
restrict
fpdata
)
void
decode_double_array_byte
(
const
unsigned
char
*
restrict
igrib
,
long
jlend
,
int
numBits
,
double
fmin
,
double
zscale
,
double
*
restrict
fpdata
)
{
#if defined _GET_X86_COUNTER || defined _GET_MACH_COUNTER
uint64_t
start_decode
,
end_decode
;
...
...
@@ -2336,7 +2336,7 @@ void decode_double_array_byte(const unsigned char * restrict igrib, long jlend,
long
jlenc
=
jlend
*
numBits
/
8
;
if
(
jlenc
>
0
)
{
lgrib
=
malloc
(
jlenc
*
sizeof
(
GRIBPACK
));
lgrib
=
(
GRIBPACK
*
)
malloc
(
jlenc
*
sizeof
(
GRIBPACK
));
if
(
lgrib
==
NULL
)
SysError
(
"No Memory!"
);
(
void
)
UNPACK_GRIB
(
igrib
,
lgrib
,
jlenc
,
-
1L
);
...
...
@@ -3095,8 +3095,11 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3,
}
else
if
(
yfunc
==
'D'
||
yfunc
==
'J'
||
yfunc
==
'R'
)
{
fsec4dp
=
(
double
*
)
malloc
(
klenp
*
sizeof
(
double
));
if
(
fsec4dp
==
NULL
)
SysError
(
"No Memory!"
);
if
(
yfunc
==
'D'
||
yfunc
==
'R'
)
{
fsec4dp
=
(
double
*
)
malloc
(
klenp
*
sizeof
(
double
));
if
(
fsec4dp
==
NULL
)
SysError
(
"No Memory!"
);
}
for
(
j
=
0
;
j
<
10
;
j
++
)
fsec2dp
[
j
]
=
0
.
0
;
for
(
j
=
0
;
j
<
2
;
j
++
)
fsec3dp
[
j
]
=
0
.
0
;
...
...
@@ -3111,20 +3114,23 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3,
fsec3sp
[
0
]
=
fsec3dp
[
0
];
fsec3sp
[
1
]
=
fsec3dp
[
1
];
inum
=
isec4
[
0
];
for
(
j
=
0
;
j
<
inum
;
j
++
)
if
(
yfunc
==
'D'
||
yfunc
==
'R'
)
{
if
(
fsec4dp
[
j
]
>
-
FLT_MIN
&&
fsec4dp
[
j
]
<
FLT_MIN
)
fsec4sp
[
j
]
=
0
;
else
if
(
fsec4dp
[
j
]
>
FLT_MAX
)
fsec4sp
[
j
]
=
FLT_MAX
;
else
if
(
fsec4dp
[
j
]
<
-
FLT_MAX
)
fsec4sp
[
j
]
=
-
FLT_MAX
;
else
fsec4sp
[
j
]
=
fsec4dp
[
j
];
}
inum
=
isec4
[
0
];
for
(
j
=
0
;
j
<
inum
;
j
++
)
{
if
(
fsec4dp
[
j
]
>
-
FLT_MIN
&&
fsec4dp
[
j
]
<
FLT_MIN
)
fsec4sp
[
j
]
=
0
;
else
if
(
fsec4dp
[
j
]
>
FLT_MAX
)
fsec4sp
[
j
]
=
FLT_MAX
;
else
if
(
fsec4dp
[
j
]
<
-
FLT_MAX
)
fsec4sp
[
j
]
=
-
FLT_MAX
;
else
fsec4sp
[
j
]
=
fsec4dp
[
j
];
}
free
(
fsec4dp
);
free
(
fsec4dp
);
}
}
else
if
(
yfunc
==
'V'
)
fprintf
(
stderr
,
" c-gribex: Version is %s
\n
"
,
cgribexLibraryVersion
());
...
...
@@ -5176,7 +5182,7 @@ void encodeBMS(GRIBPACK *lGrib, long *gribLen, double *fsec3, int *isec4, double
fsec4size
=
0
;
#if defined (VECTORCODE)
imask
=
malloc
(
imaskSize
*
sizeof
(
int
));
imask
=
(
unsigned
int
*
)
malloc
(
imaskSize
*
sizeof
(
unsigned
int
));
memset
(
imask
,
0
,
imaskSize
*
sizeof
(
int
));
#if defined (CRAY)
...
...
@@ -5549,7 +5555,7 @@ void gribEncode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
if
(
bmsIncluded
)
len
+=
(
klenp
+
7
)
>>
3
;
#if defined (VECTORCODE)
lGrib
=
malloc
(
len
*
sizeof
(
GRIBPACK
));
lGrib
=
(
GRIBPACK
*
)
malloc
(
len
*
sizeof
(
GRIBPACK
));
if
(
lGrib
==
NULL
)
SysError
(
"No Memory!"
);
#else
lGrib
=
CGrib
;
...
...
@@ -8779,10 +8785,10 @@ long packInt64(unsigned INT64 *up, unsigned char *cp, long bc, long tc)
/* unpack 8-bit bytes from a packed buffer with 64-bit words */
/* same as : for ( int i = 0; i < bc; ++i ) up[i] = (INT64) cp[i]; */
long
unpackInt64
(
unsigned
char
*
cp
,
unsigned
INT64
*
up
,
long
bc
,
long
tc
)
long
unpackInt64
(
const
unsigned
char
*
cp
,
unsigned
INT64
*
up
,
long
bc
,
long
tc
)
{
U_BYTEORDER
;
unsigned
char
*
cp0
;
const
unsigned
char
*
cp0
;
unsigned
INT64
*
up0
;
unsigned
INT64
*
ip0
,
*
ip1
,
*
ip2
,
*
ip3
,
*
ip4
,
*
ip5
,
*
ip6
,
*
ip7
;
long
head
,
trail
,
inner
,
i
,
j
;
...
...
@@ -8981,10 +8987,10 @@ long packInt32(unsigned INT32 *up, unsigned char *cp, long bc, long tc)
/* same as : for ( int i = 0; i < bc; ++i ) up[i] = (INT32) cp[i]; */
#if defined (INT32)
long
unpackInt32
(
unsigned
char
*
cp
,
unsigned
INT32
*
up
,
long
bc
,
long
tc
)
long
unpackInt32
(
const
unsigned
char
*
cp
,
unsigned
INT32
*
up
,
long
bc
,
long
tc
)
{
U_BYTEORDER
;
unsigned
char
*
cp0
;
const
unsigned
char
*
cp0
;
unsigned
INT32
*
up0
;
unsigned
INT32
*
ip0
,
*
ip1
,
*
ip2
,
*
ip3
;
long
head
,
trail
,
inner
,
i
,
j
;
...
...
@@ -10416,7 +10422,7 @@ int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufs
{
long
nelem
;
nelem
=
sourceLen
/
3
;
pbuf
=
malloc
(
sourceLen
);
pbuf
=
(
unsigned
char
*
)
malloc
(
sourceLen
);
for
(
i
=
0
;
i
<
nelem
;
i
++
)
{
pbuf
[
i
]
=
source
[
3
*
i
];
...
...
@@ -10755,7 +10761,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
long
nelem
;
unsigned
char
*
pbuf
;
nelem
=
tmpLen
/
3
;
pbuf
=
malloc
(
tmpLen
);
pbuf
=
(
unsigned
char
*
)
malloc
(
tmpLen
);
for
(
i
=
0
;
i
<
nelem
;
i
++
)
{
pbuf
[
3
*
i
]
=
dest
[
i
];
...
...
@@ -10836,7 +10842,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return
(
gribLen
);
}
static
const
char
grb_libvers
[]
=
"1.6.4"
" of ""Ma
r
28 2014"" ""1
3
:2
4
:51"
;
static
const
char
grb_libvers
[]
=
"1.6.4"
" of ""Ma
y
28 2014"" ""1
1
:2
2
:51"
;
const
char
*
cgribexLibraryVersion
(
void
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment