From 018547cdf305cc8011f8addaf62175bea2e29e18 Mon Sep 17 00:00:00 2001 From: zimoch Date: Tue, 18 Aug 2015 14:28:26 +0000 Subject: [PATCH] allow and document direct conversion from VAL/OVAL to integer to get more bits on 64 bit systems --- doc/ai.html | 6 ++++++ doc/ao.html | 6 ++++++ src/devaoStream.c | 13 +++++++++++++ 3 files changed, 25 insertions(+) diff --git a/doc/ai.html b/doc/ai.html index 47bd975..96383a4 100644 --- a/doc/ai.html +++ b/doc/ai.html @@ -41,6 +41,12 @@ written or read value. (=20.0/0xFFFF) maps 0x0000 to -10.0, 0x7FFF to 0.0 and 0xFFFF to 10.0. Using unsigned formats with values ≥ 0x800000 gives different results on 64 bit machines. +

+ If LINR=="NO CONVERSION" (the default), VAL + is directly converted from and to long without going through + RVAL. This allows for more bits on 64 bit machines. + To get the old behavior, use LINR=="LINEAR". +

ENUM format (e.g. %{):
diff --git a/doc/ao.html b/doc/ao.html index 8c0d7c7..b505dea 100644 --- a/doc/ao.html +++ b/doc/ao.html @@ -40,6 +40,12 @@ written or read value. (=20.0/0xFFFF) maps -10.0 to 0x0000, 0.0 to 0x7FFF and 10.0 to 0xFFFF. Using unsigned formats with values ≥ 0x800000 gives different results on 64 bit machines. +

+ If LINR=="NO CONVERSION" (the default), OVAL + is directly converted to long without going through + RVAL. This allows for more bits on 64 bit machines. + To get the old behavior, use LINR=="LINEAR". +

ENUM format (e.g. %{):
diff --git a/src/devaoStream.c b/src/devaoStream.c index 929d728..fb643dc 100644 --- a/src/devaoStream.c +++ b/src/devaoStream.c @@ -20,6 +20,7 @@ #include "devStream.h" #include +#include #include static long readData (dbCommon *record, format_t *format) @@ -42,6 +43,11 @@ static long readData (dbCommon *record, format_t *format) if (streamScanf (record, format, &rval)) return ERROR; ao->rbv = rval; if (INIT_RUN) ao->rval = rval; + if (ao->linr == menuConvertNO_CONVERSION) + { + ao->val = (double) rval; + return DO_NOT_CONVERT; + } return OK; } } @@ -65,6 +71,13 @@ static long writeData (dbCommon *record, format_t *format) } case DBF_LONG: { + if (ao->linr == menuConvertNO_CONVERSION) + { + long val; + if (INIT_RUN) val = (long) ao->val; + else val = (long) ao->oval; + return streamPrintf (record, format, val); + } return streamPrintf (record, format, (long) ao->rval); } }