Use uint64_t casting of constants since UL does not work on 32-bit machines

Using a UL constant in a unit64_t context does not work on a 32-bit
machine since UL is 32-bits. Instead create uint64_t constants using
static casts and the appropriate bit operators.
This commit is contained in:
Cary R 2014-12-10 14:33:29 -08:00
parent 1efa220773
commit 48b0fed29e
1 changed files with 3 additions and 3 deletions

View File

@ -3073,13 +3073,13 @@ static uint64_t vec4_to_index(vthread_t thr, bool signed_flag)
// Set the high bits that are not necessarily filled in by the
// subarray function.
if (val_size < 8*sizeof(v)) {
if (signed_flag && (v & (1UL<<(val_size-1)))) {
if (signed_flag && (v & (static_cast<uint64_t>(1)<<(val_size-1)))) {
// Propagate the sign bit...
v |= -1UL << val_size;
v |= (~static_cast<uint64_t>(0)) << val_size;
} else {
// Fill with zeros.
v &= ~(-1UL << val_size);
v &= ~((~static_cast<uint64_t>(0)) << val_size);
}
}