diff options
author | David Schleef <ds@schleef.org> | 2010-09-15 17:51:35 -0700 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2010-09-15 17:51:35 -0700 |
commit | 6fe216c6ab84e949e4910c1c09b2f59d6f2c610a (patch) | |
tree | 394bd5ba8a24f342697d9d8fea8667cd950ced5c /tools | |
parent | d7ce7adbd21c84d8a4d233d3e6010bffe2f6efa3 (diff) |
c: Fix problems related to 64-bit constants
Diffstat (limited to 'tools')
-rw-r--r-- | tools/orcc.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tools/orcc.c b/tools/orcc.c index 4600f34..84a44fa 100644 --- a/tools/orcc.c +++ b/tools/orcc.c @@ -843,7 +843,7 @@ output_program_generation (OrcProgram *p, FILE *output, int is_inline) var->size, (int)var->value.i, varnames[ORC_VAR_C1 + i]); } else if (var->size > 4) { REQUIRE(0,4,8,1); - fprintf(output, " orc_program_add_constant_int64 (p, %d, 0x%08x%08x, \"%s\");\n", + fprintf(output, " orc_program_add_constant_int64 (p, %d, 0x%08x%08xULL, \"%s\");\n", var->size, (orc_uint32)(((orc_uint64)var->value.i)>>32), (orc_uint32)(var->value.i), varnames[ORC_VAR_C1 + i]); } @@ -1008,12 +1008,19 @@ output_code_test (OrcProgram *p, FILE *output) for(i=0;i<8;i++){ var = &p->vars[ORC_VAR_C1 + i]; if (var->size) { - if (var->value.i != 0x80000000) { - fprintf(output, " orc_program_add_constant (p, %d, %u, \"%s\");\n", - var->size, (int)var->value.i, varnames[ORC_VAR_C1 + i]); + if (var->size < 8) { + if (var->value.i != 0x80000000) { + fprintf(output, " orc_program_add_constant (p, %d, 0x%08x, \"%s\");\n", + var->size, (int)var->value.i, varnames[ORC_VAR_C1 + i]); + } else { + fprintf(output, " orc_program_add_constant (p, %d, 0x%08x, \"%s\");\n", + var->size, (int)var->value.i, varnames[ORC_VAR_C1 + i]); + } } else { - fprintf(output, " orc_program_add_constant (p, %d, 0x%08x, \"%s\");\n", - var->size, (int)var->value.i, varnames[ORC_VAR_C1 + i]); + fprintf(output, " orc_program_add_constant_int64 (p, %d, " + "0x%08x%08xULL, \"%s\");\n", + var->size, (orc_uint32)(((orc_uint64)var->value.i)>>32), + (orc_uint32)(var->value.i), varnames[ORC_VAR_C1 + i]); } } } |