From d1753559728aeeac6bae65506ef99c9a7c88857b Mon Sep 17 00:00:00 2001 From: Russell-S-Harper Date: Sun, 7 Jul 2019 14:08:49 -0400 Subject: [PATCH] Adding check for EXP_FRAC compatibility in xapp. --- xa-pre-process/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xa-pre-process/main.c b/xa-pre-process/main.c index 6b2328e..85dfb5f 100644 --- a/xa-pre-process/main.c +++ b/xa-pre-process/main.c @@ -7,6 +7,11 @@ 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) { TOKEN tokens[TOKENS]; @@ -33,7 +38,7 @@ int main(int argc, char **argv) p = strchr(tokens[i].text, '"') + 1; q = strrchr(tokens[i].text, '"'); 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); break; /* Process each _SET_V("") command */