ECC-1002: Windows: encoding tests fail: 'maximum allowable value is 0'

This commit is contained in:
Shahram Najm 2019-10-07 17:58:13 +01:00
parent 9cb06b5ac6
commit a0fbb239c5
1 changed files with 1 additions and 1 deletions

View File

@ -244,7 +244,7 @@ int pack_long_unsigned_helper(grib_accessor* a, const long* val, size_t *len, in
}
if (nbits < 33) {
unsigned long maxval = (1UL << nbits)-1;
if (v > maxval) {
if (maxval > 0 && v > maxval) { /* See ECC-1002 */
grib_context_log(a->context, GRIB_LOG_ERROR,
"Key \"%s\": Trying to encode value of %ld but the maximum allowable value is %ld (number of bits=%ld)\n",
a->name, v, maxval, nbits);