Commit 1e92bbb9 by Alexandre Oliva Committed by Alexandre Oliva

real.h (struct real_value): Use the same type for all bitfields.

* real.h (struct real_value): Use the same type for all
bitfields.  Rename exp to uexp.
(REAL_EXP, SET_REAL_EXP): New accessor macros for uexp.
Adjust all uses of exp...
* builtins.c: ... here, ...
* emit-rtl.c: ... here, and ...
* real.c: ... and here.

From-SVN: r79802
parent 9175d409
2004-03-21 Alexandre Oliva <aoliva@redhat.com>
* real.h (struct real_value): Use the same type for all
bitfields. Rename exp to uexp.
(REAL_EXP, SET_REAL_EXP): New accessor macros for uexp.
Adjust all uses of exp...
* builtins.c: ... here, ...
* emit-rtl.c: ... here, and ...
* real.c: ... and here.
2004-03-21 Gabriel Dos Reis <gdr@integrable-solutions.net> 2004-03-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
* pretty-print.c (pp_base_maybe_space): New function. * pretty-print.c (pp_base_maybe_space): New function.
......
...@@ -6812,7 +6812,7 @@ fold_builtin (tree exp) ...@@ -6812,7 +6812,7 @@ fold_builtin (tree exp)
REAL_VALUE_TYPE cst; REAL_VALUE_TYPE cst;
real_convert (&cst, TYPE_MODE (type), &dconstpi); real_convert (&cst, TYPE_MODE (type), &dconstpi);
cst.exp -= 2; SET_REAL_EXP (&cst, REAL_EXP (&cst) - 2);
return build_real (type, cst); return build_real (type, cst);
} }
} }
......
...@@ -5313,7 +5313,7 @@ init_emit_once (int line_numbers) ...@@ -5313,7 +5313,7 @@ init_emit_once (int line_numbers)
REAL_VALUE_FROM_INT (dconstm2, -2, -1, double_mode); REAL_VALUE_FROM_INT (dconstm2, -2, -1, double_mode);
dconsthalf = dconst1; dconsthalf = dconst1;
dconsthalf.exp--; SET_REAL_EXP (&dconsthalf, REAL_EXP (&dconsthalf) - 1);
real_arithmetic (&dconstthird, RDIV_EXPR, &dconst1, &dconst3); real_arithmetic (&dconstthird, RDIV_EXPR, &dconst1, &dconst3);
......
...@@ -42,14 +42,23 @@ enum real_value_class { ...@@ -42,14 +42,23 @@ enum real_value_class {
struct real_value GTY(()) struct real_value GTY(())
{ {
ENUM_BITFIELD (real_value_class) class : 2; /* Use the same underlying type for all bit-fields, so as to make
sure they're packed together, otherwise REAL_VALUE_TYPE_SIZE will
be miscomputed. */
unsigned int /* ENUM_BITFIELD (real_value_class) */ class : 2;
unsigned int sign : 1; unsigned int sign : 1;
unsigned int signalling : 1; unsigned int signalling : 1;
unsigned int canonical : 1; unsigned int canonical : 1;
signed int exp : EXP_BITS; unsigned int uexp : EXP_BITS;
unsigned long sig[SIGSZ]; unsigned long sig[SIGSZ];
}; };
#define REAL_EXP(REAL) \
((int)((REAL)->uexp ^ (unsigned int)(1 << (EXP_BITS - 1))) \
- (1 << (EXP_BITS - 1)))
#define SET_REAL_EXP(REAL, EXP) \
((REAL)->uexp = ((unsigned int)(EXP) & (unsigned int)((1 << EXP_BITS) - 1)))
/* Various headers condition prototypes on #ifdef REAL_VALUE_TYPE, so it /* Various headers condition prototypes on #ifdef REAL_VALUE_TYPE, so it
needs to be a macro. We do need to continue to have a structure tag needs to be a macro. We do need to continue to have a structure tag
so that other headers can forward declare it. */ so that other headers can forward declare it. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment