Adding check for EXP_FRAC compatibility in xapp.

This commit is contained in:
Russell-S-Harper 2019-07-07 14:08:49 -04:00
parent 2bbd304ec7
commit d175355972

View File

@ -7,6 +7,11 @@
long long result; long long result;
/* Check if EXP_FRAC is compatible */
#if (1 << EXP_FRAC) != (1 << CHAR_BIT) * ((EXP_FULL + CHAR_BIT - 1) / CHAR_BIT)
#error "Code needs to be modified to handle current EXP_FRAC!"
#endif
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
TOKEN tokens[TOKENS]; TOKEN tokens[TOKENS];
@ -33,7 +38,7 @@ int main(int argc, char **argv)
p = strchr(tokens[i].text, '"') + 1; p = strchr(tokens[i].text, '"') + 1;
q = strrchr(tokens[i].text, '"'); q = strrchr(tokens[i].text, '"');
j = (int)(q - p); j = (int)(q - p);
/* Output in .BYTE format */ /* Output in .BYTE format - this code is actually dependent on EXP_FRAC */
printf("0, <(%.*s - _data), >(%.*s - _data), 0", j, p, j, p); printf("0, <(%.*s - _data), >(%.*s - _data), 0", j, p, j, p);
break; break;
/* Process each _SET_V("<expression>") command */ /* Process each _SET_V("<expression>") command */