mirror of https://github.com/ecmwf/eccodes.git
Merge pull request #24 from mkrupcale/encode-unsigned-long-pointer-increment
bits: grib_encode_unsigned_long: increment pointer, not the pointed-to value
This commit is contained in:
commit
a2d3d57789
|
@ -280,12 +280,7 @@ int grib_encode_unsigned_long(unsigned char* p, unsigned long val, long* bitp, l
|
|||
else {
|
||||
tmp = ((val >> len) | ((*p) & dmasks[n]));
|
||||
}
|
||||
*p = tmp;
|
||||
(*p)++;
|
||||
|
||||
/*Beware of code like this! compiler warning: operation may be undefined
|
||||
Read GCC manual on -Wsequence-point*/
|
||||
/* *p = ((val << -len) | ((*p)++ & dmasks[n])); */
|
||||
*p++ = tmp;
|
||||
}
|
||||
|
||||
/* write the middle words */
|
||||
|
|
|
@ -107,8 +107,7 @@ int grib_encode_unsigned_long(unsigned char* p, unsigned long val, long* bitp, l
|
|||
else {
|
||||
tmp = ((val >> len) | ((*p) & dmasks[n]));
|
||||
}
|
||||
*p = tmp;
|
||||
(*p)++;
|
||||
*p++ = tmp;
|
||||
}
|
||||
|
||||
/* write the middle words */
|
||||
|
|
Loading…
Reference in New Issue