Fix signed int/long truncation on 32-bit architectures