summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-10-19 20:49:16 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-10-19 20:49:16 +0200
commitee18798c64c6e40433413b73bf07bbe027a9cc6e (patch)
treee147705489c1038e60c99da3069ef8ad96dc8214
parent6ae98bfdd390638c1b020cbc576a590504fe24cf (diff)
downloadpcitool-ee18798c64c6e40433413b73bf07bbe027a9cc6e.tar.gz
pcitool-ee18798c64c6e40433413b73bf07bbe027a9cc6e.tar.bz2
pcitool-ee18798c64c6e40433413b73bf07bbe027a9cc6e.tar.xz
pcitool-ee18798c64c6e40433413b73bf07bbe027a9cc6e.zip
Add few messages to inform about precision problems while converting polymorphic values
-rw-r--r--pcilib/value.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pcilib/value.c b/pcilib/value.c
index 4264759..6e65307 100644
--- a/pcilib/value.c
+++ b/pcilib/value.c
@@ -141,6 +141,9 @@ pcilib_register_value_t pcilib_get_value_as_register_value(pcilib_t *ctx, const
if (ret) *ret = 0;
res = copy.ival;
+ if (copy.ival < 0)
+ pcilib_warning("Data corruption while converting negative polymorph value (%li) to the register type, result %u", copy.ival, res);
+
pcilib_clean_value(ctx, &copy);
return res;
@@ -254,6 +257,9 @@ int pcilib_convert_value_type(pcilib_t *ctx, pcilib_value_t *val, pcilib_value_t
}
break;
case PCILIB_TYPE_DOUBLE:
+ if (val->fval != round(val->fval))
+ pcilib_info("Precision is lost while converting float value %lf to integer %.0lf", val->fval, round(val->fval));
+
val->ival = round(val->fval);
val->format = NULL;
break;