BUFR decoding optimisation: loop inversion

This commit is contained in:
Shahram Najm 2018-01-04 13:52:42 +00:00
parent a62c3681da
commit 7aea7febf0
1 changed files with 7 additions and 2 deletions

View File

@ -1772,10 +1772,15 @@ static GRIB_INLINE int significanceQualifierIndex(int X,int Y)
return ret;
}
static GRIB_INLINE void reset_deeper_qualifiers(grib_accessor* significanceQualifierGroup[],int* significanceQualifierDepth, int depth)
static GRIB_INLINE void reset_deeper_qualifiers(
grib_accessor* significanceQualifierGroup[], const int* const significanceQualifierDepth, int depth)
{
int i;
for (i=0;i<number_of_qualifiers;i++) {
/* Optimisation: Loop inversion
* This is faster than:
* for (i=0;i<number_of_qualifiers;i++)
*/
for (i=number_of_qualifiers; i--; ) {
if (significanceQualifierDepth[i]>depth) {
significanceQualifierGroup[i]=0;
}