From: Matthias Braun Date: Fri, 28 Nov 2008 11:48:50 +0000 (+0000) Subject: I give up with modulo shift - doing the right thing is not compatible with firm at... X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=bfb4a8e78384d2b6e85e13be00e8d79b4083f725;p=cparser I give up with modulo shift - doing the right thing is not compatible with firm at the moment :-( [r24105] --- diff --git a/ast2firm.c b/ast2firm.c index e427c9f..6759445 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -165,6 +165,7 @@ static ir_mode *init_atomic_ir_mode(atomic_type_kind_t kind) ir_mode_sort sort; unsigned bit_size = size * 8; bool is_signed = (flags & ATOMIC_TYPE_FLAG_SIGNED) != 0; + unsigned modulo_shift; ir_mode_arithmetic arithmetic; if (flags & ATOMIC_TYPE_FLAG_INTEGER) { @@ -173,16 +174,16 @@ static ir_mode *init_atomic_ir_mode(atomic_type_kind_t kind) bit_size); sort = irms_int_number; arithmetic = irma_twos_complement; + modulo_shift = bit_size < machine_size ? machine_size : bit_size; } else { assert(flags & ATOMIC_TYPE_FLAG_FLOAT); snprintf(name, sizeof(name), "F%u", bit_size); sort = irms_float_number; arithmetic = irma_ieee754; + modulo_shift = 0; } - /* note: modulo_shift is 0, as in C it's undefined anyway to shift - * a too big amount */ return new_ir_mode(name, sort, bit_size, is_signed, arithmetic, - 0); + modulo_shift); } return NULL;