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 {
|
else {
|
||||||
tmp = ((val >> len) | ((*p) & dmasks[n]));
|
tmp = ((val >> len) | ((*p) & dmasks[n]));
|
||||||
}
|
}
|
||||||
*p = tmp;
|
*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])); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write the middle words */
|
/* write the middle words */
|
||||||
|
|
|
@ -107,8 +107,7 @@ int grib_encode_unsigned_long(unsigned char* p, unsigned long val, long* bitp, l
|
||||||
else {
|
else {
|
||||||
tmp = ((val >> len) | ((*p) & dmasks[n]));
|
tmp = ((val >> len) | ((*p) & dmasks[n]));
|
||||||
}
|
}
|
||||||
*p = tmp;
|
*p++ = tmp;
|
||||||
(*p)++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write the middle words */
|
/* write the middle words */
|
||||||
|
|
Loading…
Reference in New Issue