From 48b0fed29e1657765c3bf30a7e929bdbaad53253 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 10 Dec 2014 14:33:29 -0800 Subject: [PATCH] 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. --- vvp/vthread.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vvp/vthread.cc b/vvp/vthread.cc index e8cd2baff..b053565e7 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -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(1)<<(val_size-1)))) { // Propagate the sign bit... - v |= -1UL << val_size; + v |= (~static_cast(0)) << val_size; } else { // Fill with zeros. - v &= ~(-1UL << val_size); + v &= ~((~static_cast(0)) << val_size); } }