From 484d3ea36b3d82c7720484116be7087d076e727f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20W=C3=A4chtler?= Date: Mon, 28 Jul 2008 21:40:58 +0200 Subject: [PATCH] this patch adds support for conversion of negative vpiDecStrVal in vpip_dec_str_to_vec4() --- vvp/vpip_to_dec.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vvp/vpip_to_dec.cc b/vvp/vpip_to_dec.cc index 782c31c0c..a601f70bb 100644 --- a/vvp/vpip_to_dec.cc +++ b/vvp/vpip_to_dec.cc @@ -229,7 +229,12 @@ void vpip_dec_str_to_vec4(vvp_vector4_t&vec, input is "1234", str gets "4321". */ unsigned slen = strlen(buf); char*str = new char[slen + 1]; + int is_negative = 0; for (unsigned idx = 0 ; idx < slen ; idx += 1) { + if (idx == slen-1 && buf[slen-idx-1] == '-') { + is_negative = 1; + continue; + } if (isdigit(buf[slen-idx-1])) str[idx] = buf[slen-idx-1]; else @@ -266,5 +271,10 @@ void vpip_dec_str_to_vec4(vvp_vector4_t&vec, } + if (is_negative) { + vec.invert(); + vec += 1; + } + delete[]str; }