diff options
-rw-r--r-- | device-functions.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/device-functions.c b/device-functions.c index 2f4f2cf..f72b275 100644 --- a/device-functions.c +++ b/device-functions.c @@ -2826,11 +2826,18 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int +(*UseNegData)*max_points +(entry_i); - if ( (fabs(pwl_amp[index]-pwl_amp[index+1])>smallest_allowed_number) + // we copy these floats out into variables because anything that touches + // floats seems to generate instructions that can't work on unaligned + // data and these are unaligned. + float pwlamp1, pwlamp2; + memcpy(&pwlamp1, &pwl_amp[index], sizeof(pwlamp1)); + memcpy(&pwlamp2, &pwl_amp[index+1], sizeof(pwlamp2)); + + if ( (fabs(pwlamp1-pwlamp2)>smallest_allowed_number) && - ( ((tweaked_use_ampl>=pwl_amp[index]) && (tweaked_use_ampl<=pwl_amp[index+1])) + ( ((tweaked_use_ampl>=pwlamp1) && (tweaked_use_ampl<=pwlamp2)) || - (decreasing_values_allowed && (tweaked_use_ampl<=pwl_amp[index]) && (tweaked_use_ampl>=pwl_amp[index+1])) /* for OS only */ + (decreasing_values_allowed && (tweaked_use_ampl<=pwlamp1) && (tweaked_use_ampl>=pwlamp2)) /* for OS only */ ) ) { *point_found=1; @@ -2863,7 +2870,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int } } - fraction = (tweaked_use_ampl-pwl_amp[index]) / (pwl_amp[index] - pwl_amp[index+1]); + fraction = (tweaked_use_ampl-pwlamp1) / (pwlamp1 - pwlamp2); *relay_range=range_i; *entry=entry_i; |