This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I don't want to sound bikesheding, so feel free to ignore my comments if you can't bother to change your patch. Why use a switch + enum type? This seems too complex and without any speed benefit. Wouldn't it be better to use inline or macro for each constant?
That is in real.h for example for dconstsqrt2:
#define dconst_sqrt2 get_real_dconst_sqrt2()
static inline const REAL_VALUE_TYPE * get_real_dconst_sqrt2 (void) { static REAL_VALUE_TYPE value = rvc_zero;
if (value == rvc_zero) { mpfr_t m; mpfr_init2 (m, SIGNIFICAND_BITS); mpfr_sqrt_ui (m, 2, GMP_RNDN); real_from_mpfr (&value, m, NULL_TREE, GMP_RNDN); mpfr_clear (m); } return &value; }
Moreover, I think we can use __builtin_expect for the condition and mark the function as pure.
Also, dconst_x is more readable and seems more robust and consistent than a mix of dconstx and get_real_const (rv_x).
Thanks, --Kaveh -- Kaveh R. Ghazi
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |