Skip to content

Commit

Permalink
correct mask for finding field in linkGrp
Browse files Browse the repository at this point in the history
It worked before because the get_xxx functions are never called for
the links (bit0 = 1), but checking both bits looks cleaner.
  • Loading branch information
dirk-zimoch committed Nov 29, 2024
1 parent 35ba9d6 commit 1567da1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/database/src/std/rec/seqRecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static long get_units(DBADDR *paddr, char *units)
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0);

if (fieldOffset >= 0)
switch (fieldOffset & 2) {
switch (fieldOffset & 3) {
case 0: /* DLYn */
strcpy(units, "s");
break;
Expand All @@ -303,7 +303,7 @@ static long get_precision(const DBADDR *paddr, long *pprecision)
short precision;

if (fieldOffset >= 0)
switch (fieldOffset & 2) {
switch (fieldOffset & 3) {
case 0: /* DLYn */
*pprecision = seqDLYprecision;
return 0;
Expand All @@ -324,7 +324,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0);

if (fieldOffset >= 0)
switch (fieldOffset & 2) {
switch (fieldOffset & 3) {
case 0: /* DLYn */
pgd->lower_disp_limit = 0.0;
pgd->lower_disp_limit = 10.0;
Expand All @@ -343,7 +343,7 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
{
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0);

if (fieldOffset >= 0 && (fieldOffset & 2) == 0) { /* DLYn */
if (fieldOffset >= 0 && (fieldOffset & 3) == 0) { /* DLYn */
pcd->lower_ctrl_limit = 0.0;
pcd->upper_ctrl_limit = seqDLYlimit;
}
Expand All @@ -357,7 +357,7 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
seqRecord *prec = (seqRecord *) paddr->precord;
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0);

if (fieldOffset >= 0 && (fieldOffset & 2) == 2) /* DOn */
if (fieldOffset >= 0 && (fieldOffset & 3) == 2) /* DOn */
dbGetAlarmLimits(get_dol(prec, fieldOffset),
&pad->lower_alarm_limit, &pad->lower_warning_limit,
&pad->upper_warning_limit, &pad->upper_alarm_limit);
Expand Down

0 comments on commit 1567da1

Please sign in to comment.