allow and document direct conversion from VAL/OVAL to integer to get more bits on 64 bit systems
This commit is contained in:
@ -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.
|
||||
<p class="new">
|
||||
If <code>LINR=="NO CONVERSION"</code> (the default), <code>VAL</code>
|
||||
is directly converted from and to <code>long</code> without going through
|
||||
<code>RVAL</code>. This allows for more bits on 64 bit machines.
|
||||
To get the old behavior, use <code>LINR=="LINEAR"</code>.
|
||||
</p>
|
||||
</dd>
|
||||
<dt>ENUM format (e.g. <code>%{</code>):</dt>
|
||||
<dd>
|
||||
|
@ -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.
|
||||
<p class="new">
|
||||
If <code>LINR=="NO CONVERSION"</code> (the default), <code>OVAL</code>
|
||||
is directly converted to <code>long</code> without going through
|
||||
<code>RVAL</code>. This allows for more bits on 64 bit machines.
|
||||
To get the old behavior, use <code>LINR=="LINEAR"</code>.
|
||||
</p>
|
||||
</dd>
|
||||
<dt>ENUM format (e.g. <code>%{</code>):</dt>
|
||||
<dd>
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "devStream.h"
|
||||
#include <aoRecord.h>
|
||||
#include <menuConvert.h>
|
||||
#include <epicsExport.h>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user