* have to do proper sign extension.
*/
if (carry == 0 && byte < sizeof(int64))
- res |= ((int64) -1) << (byte * 8);
+ res |= ((uint64) (int64) -1) << (byte * 8);
}
PG_RETURN_INT64(res);
/* store first fractional byte */
if (destbitsleft > srcbitsleft)
{
- int val = (int) (a >> (destbitsleft - 8));
+ unsigned int val = (unsigned int) (a >> (destbitsleft - 8));
/* Force sign-fill in case the compiler implements >> as zero-fill */
if (a < 0)
- val |= (-1) << (srcbitsleft + 8 - destbitsleft);
+ val |= ((unsigned int) -1) << (srcbitsleft + 8 - destbitsleft);
*r++ = (bits8) (val & BITMASK);
destbitsleft -= 8;
}
/* store first fractional byte */
if (destbitsleft > srcbitsleft)
{
- int val = (int) (a >> (destbitsleft - 8));
+ unsigned int val = (unsigned int) (a >> (destbitsleft - 8));
/* Force sign-fill in case the compiler implements >> as zero-fill */
if (a < 0)
- val |= (-1) << (srcbitsleft + 8 - destbitsleft);
+ val |= ((unsigned int) -1) << (srcbitsleft + 8 - destbitsleft);
*r++ = (bits8) (val & BITMASK);
destbitsleft -= 8;
}