If ai uses no conversion, transport long i/o to and from val directly. This preverves more bits on 64 bit systems than going through the 32 bit rval field.

This commit is contained in:
zimoch
2015-07-17 13:24:37 +00:00
parent be1943a66d
commit cc5948ad0b

View File

@ -20,6 +20,7 @@
#include "devStream.h" #include "devStream.h"
#include <aiRecord.h> #include <aiRecord.h>
#include <menuConvert.h>
#include <epicsExport.h> #include <epicsExport.h>
static long readData (dbCommon *record, format_t *format) static long readData (dbCommon *record, format_t *format)
@ -45,6 +46,11 @@ static long readData (dbCommon *record, format_t *format)
{ {
long rval; long rval;
if (streamScanf (record, format, &rval)) return ERROR; if (streamScanf (record, format, &rval)) return ERROR;
if (ai->linr == menuConvertNO_CONVERSION)
{
ai->val = (double) rval;
return DO_NOT_CONVERT;
}
ai->rval = rval; ai->rval = rval;
return OK; return OK;
} }
@ -67,6 +73,10 @@ static long writeData (dbCommon *record, format_t *format)
} }
case DBF_LONG: case DBF_LONG:
{ {
if (ai->linr == menuConvertNO_CONVERSION)
{
return streamPrintf (record, format, (long) ai->val);
}
return streamPrintf (record, format, (long) ai->rval); return streamPrintf (record, format, (long) ai->rval);
} }
} }