You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The C-Code generator generates wrong code for range check. This code is generated:
if((rval <= -1023.500000) && (rval >= 1023.500000)) {
But the genrator should generate:
if((rval >= -1023.500000) && (rval <= 1023.500000)) {
To fix this, just change
fprintf(o, "\tif((rval <= %f) && (rval >= %f)) {\n", sig->minimum, sig->maximum);
in file 2c.c:239 to:
fprintf(o, "\tif((rval >= %f) && (rval <= %f)) {\n", sig->minimum, sig->maximum);
The text was updated successfully, but these errors were encountered:
xR3b0rn
changed the title
C-Code generation
C-Code generation signal range check
Oct 12, 2018
The encode and decode functions have been improved, but there is still a
lot to do to make the code generator better than it is. This has been
highlighted in the many '@todo' comments added.
* Range checks have been added to the encode/decode functions.
* encode/decode functions have a better interface
* This new interface broke the old way of printing variables, so this
will have to be restored somehow.
The C-Code generator generates wrong code for range check. This code is generated:
if((rval <= -1023.500000) && (rval >= 1023.500000)) {
But the genrator should generate:
if((rval >= -1023.500000) && (rval <= 1023.500000)) {
To fix this, just change
fprintf(o, "\tif((rval <= %f) && (rval >= %f)) {\n", sig->minimum, sig->maximum);
in file 2c.c:239 to:
fprintf(o, "\tif((rval >= %f) && (rval <= %f)) {\n", sig->minimum, sig->maximum);
The text was updated successfully, but these errors were encountered: