Commit e5f7c590 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Make expression branch-free.

parent 5bd7caab
......@@ -5194,7 +5194,7 @@ int isHybridSigmaPressureCoordinate(int ncid, int ncvarid, ncvar_t *ncvars, cons
printf("%d %g %g %g %g\n", i, abuf[i*2], abuf[i*2+1], bbuf[i*2], bbuf[i*2+1]);
*/
size_t vctsize = (dimlen+1)*2;
double *vct = (double *)xmalloc(vctsize*sizeof(double));
double *vct = (double *)xmalloc(vctsize * sizeof(double));
for ( size_t i = 0; i < dimlen; ++i )
{
vct[i] = abuf[i*2];
......
......@@ -1201,10 +1201,7 @@ splitTimevalue(double timevalue, int timeunit, int *date, int *time)
}
else if ( timeunit == TUNIT_MONTH )
{
vdate = (int) timevalue*100;
if ( vdate < 0 ) vdate -= 1;
else vdate += 1;
vdate = (int) timevalue*100 - ((vdate < 0) * 2 - 1);
vtime = 0;
}
else if ( timeunit == TUNIT_YEAR )
......
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