From ff2ec85b6138789c8ea7f696838204c13c32294e Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 2 Feb 2003 00:43:16 +0000 Subject: [PATCH] Fix conversion of signed numbes to long --- verinum.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/verinum.cc b/verinum.cc index a2e45a152..b51b24888 100644 --- a/verinum.cc +++ b/verinum.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: verinum.cc,v 1.36 2003/01/30 16:23:08 steve Exp $" +#ident "$Id: verinum.cc,v 1.37 2003/02/02 00:43:16 steve Exp $" #endif # include "config.h" @@ -220,10 +220,13 @@ signed long verinum::as_long() const val = -1; signed long mask = ~1L; - for (unsigned idx = 0 ; idx < top ; idx += 1, mask <<= 1) + for (unsigned idx = 0 ; idx < top ; idx += 1) { if (bits_[idx] == V0) val &= mask; + mask = (mask << 1) | 1L; + } + } else { unsigned top = nbits_; if (top > (8 * sizeof(long) - 1)) @@ -815,6 +818,9 @@ verinum::V operator & (verinum::V l, verinum::V r) /* * $Log: verinum.cc,v $ + * Revision 1.37 2003/02/02 00:43:16 steve + * Fix conversion of signed numbes to long + * * Revision 1.36 2003/01/30 16:23:08 steve * Spelling fixes. *