Commit 578bd753 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Make function xsum inline.

parent 1a701c17
......@@ -271,7 +271,7 @@ varsMapNDeco(int nNodes, int *nodeSizes)
for ( i = 0; i < nStreams; i++ )
streamSizes[i] = streamInqNvars ( * ( resHs + i ));
nVars = xsum ( nStreams, streamSizes );
nVars = sum_int(nStreams, streamSizes);
varSizes = xmalloc ( nVars * sizeof ( varSizes[0] ));
varMapping = xmalloc ( nVars * sizeof ( varMapping[0] ));
......
......@@ -193,21 +193,6 @@ void pcdiDebugMsg2 ( const char *filename, const char *functionname, int line,
/****************************************************/
int xsum ( int n, int * argarray )
{
int i, sum = 0;
for ( i = 0; i < n; i++ )
sum += * ( argarray + i );
return sum;
}
/****************************************************/
double xchecksum ( int type, int count, void * buffer )
{
return 0.0;
......
......@@ -140,7 +140,15 @@ void pcdiDebugMsg2 ( const char *filename, const char *functionname, int line, \
#define xdebugMsg2(tag,source,text) \
if ( ddebug ) pcdiDebugMsg ( __FILE__, __func__, __LINE__, tag, source, text )
int xsum ( int, int * );
static inline int
sum_int(size_t n, int *a)
{
int sum = 0;
for (size_t i = 0; i < n; ++i)
sum += a[i];
return sum;
}
double xchecksum ( int, int, void * );
......
Supports Markdown
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