From 296f1bacc1ef617c7a807ba7e6246130e96061f5 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 30 Jul 2008 15:35:29 -0700 Subject: [PATCH] vvp_vector4_t words are unsigned long. The double to vvp_vector4_t constructor was not using the correct declaration for the bit words. This worked as long as unsigned and unsigned long were the same size (usually). --- vvp/vvp_net.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 277732560..a8c669e26 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -416,14 +416,14 @@ vvp_vector4_t::vvp_vector4_t(unsigned size, double val) /* Skip any leading bits. */ for (int idx = (signed) nwords; idx > (signed) my_words; idx -=1) { - unsigned bits = (unsigned) fraction; + unsigned long bits = (unsigned long) fraction; fraction = fraction - (double) bits; fraction = ldexp(fraction, BITS_PER_WORD); } /* Convert the remaining bits as appropriate. */ if (my_words == 0) { - unsigned bits = (unsigned) fraction; + unsigned long bits = (unsigned long) fraction; abits_val_ = bits; fraction = fraction - (double) bits; /* Round any fractional part up. */ @@ -431,7 +431,7 @@ vvp_vector4_t::vvp_vector4_t(unsigned size, double val) } else { if (nwords < my_words) my_words = nwords; for (int idx = (signed)my_words; idx >= 0; idx -= 1) { - unsigned bits = (unsigned) fraction; + unsigned long bits = (unsigned long) fraction; abits_ptr_[idx] = bits; fraction = fraction - (double) bits; fraction = ldexp(fraction, BITS_PER_WORD);