22 #include "floatformat.h" 38 const char *format)
const = 0;
51 double val)
const = 0;
83 #define FLOATFORMAT_CHAR_BIT 8 87 #define FLOATFORMAT_LARGEST_BYTES 16 108 int prec = fmt->man_len;
109 if (fmt->intbit == floatformat_intbit_no)
118 static enum floatformat_byteorders
120 const void *from,
void *to)
122 const unsigned char *swapin;
123 unsigned char *swapout;
126 if (fmt->byteorder == floatformat_little
127 || fmt->byteorder == floatformat_big)
128 return fmt->byteorder;
133 swapout = (
unsigned char *)to;
134 swapin = (
const unsigned char *)from;
136 if (fmt->byteorder == floatformat_vax)
140 *swapout++ = swapin[1];
141 *swapout++ = swapin[0];
142 *swapout++ = swapin[3];
143 *swapout++ = swapin[2];
148 return floatformat_big;
152 gdb_assert (fmt->byteorder == floatformat_littlebyte_bigword);
156 *swapout++ = swapin[3];
157 *swapout++ = swapin[2];
158 *swapout++ = swapin[1];
159 *swapout++ = swapin[0];
162 return floatformat_big;
169 get_field (
const bfd_byte *data,
enum floatformat_byteorders order,
170 unsigned int total_len,
unsigned int start,
unsigned int len)
172 unsigned long result;
173 unsigned int cur_byte;
177 gdb_assert (order == floatformat_little || order == floatformat_big);
180 if (order == floatformat_little)
203 result = *(data + cur_byte) >> (-cur_bitshift);
207 if (order == floatformat_little)
213 while (cur_bitshift < len)
215 result |= (
unsigned long)*(data + cur_byte) << cur_bitshift;
219 case floatformat_little:
222 case floatformat_big:
229 result &= ((1UL << len) - 1);
236 put_field (
unsigned char *data,
enum floatformat_byteorders order,
237 unsigned int total_len,
unsigned int start,
unsigned int len,
238 unsigned long stuff_to_put)
240 unsigned int cur_byte;
244 gdb_assert (order == floatformat_little || order == floatformat_big);
247 if (order == floatformat_little)
264 *(data + cur_byte) &=
267 *(data + cur_byte) |=
271 if (order == floatformat_little)
277 while (cur_bitshift < len)
282 *(data + cur_byte) &=
283 ~((1 << (len - cur_bitshift)) - 1);
284 *(data + cur_byte) |= (stuff_to_put >> cur_bitshift);
287 *(data + cur_byte) = ((stuff_to_put >> cur_bitshift)
290 if (order == floatformat_little)
301 const bfd_byte *uval)
303 enum floatformat_byteorders order;
313 fmt = fmt->split_half;
317 if (order != fmt->byteorder)
320 return get_field (uval, order, fmt->totalsize, fmt->sign_start, 1);
326 const bfd_byte *uval)
330 unsigned int mant_bits, mant_off;
332 enum floatformat_byteorders order;
345 fmt = fmt->split_half;
349 if (order != fmt->byteorder)
352 exponent =
get_field (uval, order, fmt->totalsize, fmt->exp_start,
355 mant_bits_left = fmt->man_len;
356 mant_off = fmt->man_start;
359 while (mant_bits_left > 0)
361 mant_bits = std::min (mant_bits_left, 32);
363 mant =
get_field (uval, order, fmt->totalsize, mant_off, mant_bits);
366 if (mant_off == fmt->man_start
367 && fmt->intbit == floatformat_intbit_yes)
368 mant &= ~(1 << (mant_bits - 1));
376 mant_off += mant_bits;
377 mant_bits_left -= mant_bits;
398 if (exponent == fmt->exp_nan)
416 unsigned char *uval = (
unsigned char *) val;
418 unsigned int mant_bits, mant_off;
423 enum floatformat_byteorders order;
438 fmt = fmt->split_half;
442 if (order != fmt->byteorder)
449 gdb_assert (
sizeof res > ((fmt->man_len + 7) / 8) * 2);
451 mant_off = fmt->man_start;
452 mant_bits_left = fmt->man_len;
453 mant_bits = (mant_bits_left % 32) > 0 ? mant_bits_left % 32 : 32;
455 mant =
get_field (uval, order, fmt->totalsize, mant_off, mant_bits);
457 len =
xsnprintf (res,
sizeof res,
"%lx", mant);
459 mant_off += mant_bits;
460 mant_bits_left -= mant_bits;
462 while (mant_bits_left > 0)
464 mant =
get_field (uval, order, fmt->totalsize, mant_off, 32);
466 xsnprintf (buf,
sizeof buf,
"%08lx", mant);
467 gdb_assert (len + strlen (buf) <=
sizeof res);
471 mant_bits_left -= 32;
484 const char *format,
char length)
489 if (format ==
nullptr)
499 const double log10_2 = .30102999566398119521;
501 int decimal_dig = d_decimal_dig;
502 if (decimal_dig < d_decimal_dig)
512 size_t len = strlen (format);
514 conversion = format[--len];
515 gdb_assert (conversion ==
'e' || conversion ==
'f' || conversion ==
'g' 516 || conversion ==
'E' || conversion ==
'G');
517 if (format[len - 1] ==
'L')
526 host_format += length;
527 host_format += conversion;
539 const char *format)
const override;
544 const struct type *
type)
const override;
550 const struct type *
type)
const override;
552 double val)
const override;
554 gdb_byte *to,
const struct type *to_type)
const override;
559 gdb_byte *res,
const struct type *type_res)
const override;
561 const gdb_byte *y,
const struct type *type_y)
const override;
571 void to_target (
const struct floatformat *fmt,
598 template<
typename T>
void 629 unsigned char *ufrom = (
unsigned char *) from;
633 unsigned int mant_bits, mant_off;
635 int special_exponent;
636 enum floatformat_byteorders order;
651 floatformat_to_double (fmt->split_half ? fmt->split_half : fmt,
659 if (order != fmt->byteorder)
666 from_target (fmt->split_half, ufrom, &dtop);
674 from_target (fmt->split_half,
680 exponent =
get_field (ufrom, order, fmt->totalsize, fmt->exp_start,
686 mant_bits_left = fmt->man_len;
687 mant_off = fmt->man_start;
690 special_exponent = exponent == 0 || exponent == fmt->exp_nan;
696 if (!special_exponent)
697 exponent -= fmt->exp_bias;
698 else if (exponent == 0)
699 exponent = 1 - fmt->exp_bias;
707 if (!special_exponent)
709 if (fmt->intbit == floatformat_intbit_no)
710 dto = ldexp (1.0, exponent);
715 while (mant_bits_left > 0)
717 mant_bits = std::min (mant_bits_left, 32);
719 mant =
get_field (ufrom, order, fmt->totalsize, mant_off, mant_bits);
721 dto += ldexp ((T) mant, exponent - mant_bits);
722 exponent -= mant_bits;
723 mant_off += mant_bits;
724 mant_bits_left -= mant_bits;
728 if (
get_field (ufrom, order, fmt->totalsize, fmt->sign_start, 1))
733 template<
typename T>
void 742 template<
typename T>
void 764 long double val = *from;
773 unsigned int mant_bits, mant_off;
775 unsigned char *uto = (
unsigned char *) to;
776 enum floatformat_byteorders order = fmt->byteorder;
779 if (order != floatformat_little)
780 order = floatformat_big;
782 if (order != fmt->byteorder)
785 memcpy (&dfrom, from,
sizeof (dfrom));
793 static volatile double dtop, dbot;
796 dtop = (double) dfrom;
799 if (dtop + dtop == dtop && dtop != 0.0)
802 dbot = (double) (dfrom - (T) dtop);
805 to_target (fmt->split_half, &dtopnv, uto);
806 to_target (fmt->split_half, &dbotnv,
812 goto finalize_byteorder;
816 put_field (uto, order, fmt->totalsize, fmt->exp_start,
817 fmt->exp_len, fmt->exp_nan);
819 put_field (uto, order, fmt->totalsize, fmt->man_start,
821 goto finalize_byteorder;
827 put_field (uto, order, fmt->totalsize, fmt->sign_start, 1, 1);
831 if (dfrom + dfrom == dfrom && dfrom != 0.0)
834 put_field (uto, order, fmt->totalsize, fmt->exp_start,
835 fmt->exp_len, fmt->exp_nan);
837 put_field (uto, order, fmt->totalsize, fmt->man_start,
839 goto finalize_byteorder;
842 mant = frexp (dfrom, &exponent);
844 if (exponent + fmt->exp_bias <= 0)
848 put_field (uto, order, fmt->totalsize, fmt->exp_start,
850 put_field (uto, order, fmt->totalsize, fmt->man_start,
852 goto finalize_byteorder;
855 if (exponent + fmt->exp_bias >= (1 << fmt->exp_len))
859 put_field (uto, order, fmt->totalsize, fmt->exp_start,
860 fmt->exp_len, fmt->exp_nan);
861 put_field (uto, order, fmt->totalsize, fmt->man_start,
863 goto finalize_byteorder;
866 put_field (uto, order, fmt->totalsize, fmt->exp_start, fmt->exp_len,
867 exponent + fmt->exp_bias - 1);
869 mant_bits_left = fmt->man_len;
870 mant_off = fmt->man_start;
871 while (mant_bits_left > 0)
873 unsigned long mant_long;
875 mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;
877 mant *= 4294967296.0;
878 mant_long = ((
unsigned long) mant) & 0xffffffff
L;
885 if (mant_bits_left == fmt->man_len
886 && fmt->intbit == floatformat_intbit_no)
889 mant_long &= 0xffffffff
L;
905 mant_long >>= 32 - mant_bits;
909 mant_off, mant_bits, mant_long);
910 mant_off += mant_bits;
911 mant_bits_left -= mant_bits;
916 if (order != fmt->byteorder)
920 template<
typename T>
void 942 const char *format)
const 968 template<
typename T>
bool 978 scan_format +=
"g%n";
980 num = sscanf (in.c_str (), scan_format.c_str(), &
host_float, &n);
1006 if (
host_float > std::numeric_limits<LONGEST>::max())
1007 return std::numeric_limits<LONGEST>::max();
1008 if (
host_float < std::numeric_limits<LONGEST>::min())
1009 return std::numeric_limits<LONGEST>::min();
1015 template<
typename T>
void 1025 template<
typename T>
void 1035 template<
typename T>
double 1046 template<
typename T>
void 1057 template<
typename T>
void 1059 const struct type *from_type,
1061 const struct type *to_type)
const 1072 template<
typename T>
void 1080 from_target (type_x, x, &v1);
1081 from_target (type_y, y, &v2);
1105 error (
_(
"Cannot perform exponentiation: %s"),
1110 v = v1 < v2 ? v1 : v2;
1114 v = v1 > v2 ? v1 : v2;
1118 error (
_(
"Integer-only operation on floating point number."));
1122 to_target (type_res, &v, res);
1128 template<
typename T>
int 1134 from_target (type_x, x, &v1);
1135 from_target (type_y, y, &v2);
1150 #define MPFR_USE_INTMAX_T 1158 const char *format)
const override;
1163 const struct type *
type)
const override;
1169 const struct type *
type)
const override;
1171 double val)
const override;
1173 gdb_byte *to,
const struct type *to_type)
const override;
1178 gdb_byte *res,
const struct type *type_res)
const override;
1180 const gdb_byte *y,
const struct type *type_y)
const override;
1197 mpfr_init2 (
val, mpfr_get_prec (source.
val));
1207 const gdb_byte *from, gdb_mpfr &to)
const;
1209 const gdb_byte *from, gdb_mpfr &to)
const;
1212 const gdb_mpfr &from,
gdb_byte *to)
const;
1213 void to_target (
const struct floatformat *fmt,
1214 const gdb_mpfr &from,
gdb_byte *to)
const;
1225 mpfr_exp_t exponent;
1227 unsigned int mant_bits, mant_off;
1229 int special_exponent;
1230 enum floatformat_byteorders order;
1246 mpfr_set_nan (to.
val);
1252 if (order != fmt->byteorder)
1255 if (fmt->split_half)
1261 if (mpfr_zero_p (top.val))
1263 mpfr_set (to.
val, top.val, MPFR_RNDN);
1268 mpfr_add (to.
val, top.val, bot.
val, MPFR_RNDN);
1272 exponent =
get_field (from, order, fmt->totalsize, fmt->exp_start,
1278 mant_bits_left = fmt->man_len;
1279 mant_off = fmt->man_start;
1280 mpfr_set_zero (to.
val, 0);
1282 special_exponent = exponent == 0 || exponent == fmt->exp_nan;
1288 if (!special_exponent)
1289 exponent -= fmt->exp_bias;
1290 else if (exponent == 0)
1291 exponent = 1 - fmt->exp_bias;
1299 if (!special_exponent)
1301 if (fmt->intbit == floatformat_intbit_no)
1302 mpfr_set_ui_2exp (to.
val, 1, exponent, MPFR_RNDN);
1309 while (mant_bits_left > 0)
1311 mant_bits = std::min (mant_bits_left, 32);
1313 mant =
get_field (from, order, fmt->totalsize, mant_off, mant_bits);
1315 mpfr_set_ui (tmp.
val, mant, MPFR_RNDN);
1316 mpfr_mul_2si (tmp.
val, tmp.
val, exponent - mant_bits, MPFR_RNDN);
1317 mpfr_add (to.
val, to.
val, tmp.
val, MPFR_RNDN);
1318 exponent -= mant_bits;
1319 mant_off += mant_bits;
1320 mant_bits_left -= mant_bits;
1324 if (
get_field (from, order, fmt->totalsize, fmt->sign_start, 1))
1325 mpfr_neg (to.
val, to.
val, MPFR_RNDN);
1339 unsigned char *to = orig_to;
1340 mpfr_exp_t exponent;
1341 unsigned int mant_bits, mant_off;
1343 enum floatformat_byteorders order = fmt->byteorder;
1346 if (order != floatformat_little)
1347 order = floatformat_big;
1349 if (order != fmt->byteorder)
1354 if (fmt->split_half)
1358 mpfr_set (top.val, from.
val, MPFR_RNDN);
1361 if (mpfr_inf_p (top.val))
1362 mpfr_set_zero (bot.
val, 0);
1364 mpfr_sub (bot.
val, from.
val, top.val, MPFR_RNDN);
1374 if (mpfr_zero_p (from.
val))
1375 goto finalize_byteorder;
1377 mpfr_set (tmp.
val, from.
val, MPFR_RNDN);
1379 if (mpfr_nan_p (tmp.
val))
1382 put_field (to, order, fmt->totalsize, fmt->exp_start,
1383 fmt->exp_len, fmt->exp_nan);
1385 put_field (to, order, fmt->totalsize, fmt->man_start,
1387 goto finalize_byteorder;
1391 if (mpfr_sgn (tmp.
val) < 0)
1393 put_field (to, order, fmt->totalsize, fmt->sign_start, 1, 1);
1394 mpfr_neg (tmp.
val, tmp.
val, MPFR_RNDN);
1397 if (mpfr_inf_p (tmp.
val))
1400 put_field (to, order, fmt->totalsize, fmt->exp_start,
1401 fmt->exp_len, fmt->exp_nan);
1403 put_field (to, order, fmt->totalsize, fmt->man_start,
1405 goto finalize_byteorder;
1408 mpfr_frexp (&exponent, tmp.
val, tmp.
val, MPFR_RNDN);
1410 if (exponent + fmt->exp_bias <= 0)
1414 put_field (to, order, fmt->totalsize, fmt->exp_start,
1416 put_field (to, order, fmt->totalsize, fmt->man_start,
1418 goto finalize_byteorder;
1421 if (exponent + fmt->exp_bias >= (1 << fmt->exp_len))
1425 put_field (to, order, fmt->totalsize, fmt->exp_start,
1426 fmt->exp_len, fmt->exp_nan);
1427 put_field (to, order, fmt->totalsize, fmt->man_start,
1429 goto finalize_byteorder;
1432 put_field (to, order, fmt->totalsize, fmt->exp_start, fmt->exp_len,
1433 exponent + fmt->exp_bias - 1);
1435 mant_bits_left = fmt->man_len;
1436 mant_off = fmt->man_start;
1437 while (mant_bits_left > 0)
1439 unsigned long mant_long;
1441 mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;
1443 mpfr_mul_2ui (tmp.
val, tmp.
val, 32, MPFR_RNDN);
1444 mant_long = mpfr_get_ui (tmp.
val, MPFR_RNDZ) & 0xffffffff
L;
1445 mpfr_sub_ui (tmp.
val, tmp.
val, mant_long, MPFR_RNDZ);
1451 if (mant_bits_left == fmt->man_len
1452 && fmt->intbit == floatformat_intbit_no)
1455 mant_long &= 0xffffffff
L;
1463 if (mant_bits == 32)
1471 mant_long >>= 32 - mant_bits;
1475 mant_off, mant_bits, mant_long);
1476 mant_off += mant_bits;
1477 mant_bits_left -= mant_bits;
1482 if (order != fmt->byteorder)
1501 const char *format)
const 1507 if (format ==
nullptr)
1510 if (!floatformat_is_valid (fmt, addr))
1511 return "<invalid float value>";
1534 int size = mpfr_snprintf (NULL, 0, host_format.c_str (), tmp.
val);
1536 mpfr_sprintf (&str[0], host_format.c_str (), tmp.
val);
1551 mpfr_strtofr (tmp.
val, in.c_str (), &endptr, 0, MPFR_RNDN);
1569 return mpfr_get_sj (tmp.
val, MPFR_RNDZ);
1580 mpfr_set_sj (tmp.
val, val, MPFR_RNDN);
1592 mpfr_set_uj (tmp.
val, val, MPFR_RNDN);
1604 return mpfr_get_d (tmp.
val, MPFR_RNDN);
1615 mpfr_set_d (tmp.
val, val, MPFR_RNDN);
1624 const struct type *from_type,
1626 const struct type *to_type)
const 1628 gdb_mpfr from_tmp (from_type), to_tmp (to_type);
1630 mpfr_set (to_tmp.
val, from_tmp.val, MPFR_RNDN);
1644 gdb_mpfr x_tmp (type_x), y_tmp (type_y), tmp (type_res);
1652 mpfr_add (tmp.
val, x_tmp.val, y_tmp.val, MPFR_RNDN);
1656 mpfr_sub (tmp.
val, x_tmp.val, y_tmp.val, MPFR_RNDN);
1660 mpfr_mul (tmp.
val, x_tmp.val, y_tmp.val, MPFR_RNDN);
1664 mpfr_div (tmp.
val, x_tmp.val, y_tmp.val, MPFR_RNDN);
1668 mpfr_pow (tmp.
val, x_tmp.val, y_tmp.val, MPFR_RNDN);
1672 mpfr_min (tmp.
val, x_tmp.val, y_tmp.val, MPFR_RNDN);
1676 mpfr_max (tmp.
val, x_tmp.val, y_tmp.val, MPFR_RNDN);
1680 error (
_(
"Integer-only operation on floating point number."));
1694 gdb_mpfr x_tmp (type_x), y_tmp (type_y);
1699 if (mpfr_equal_p (x_tmp.val, y_tmp.
val))
1701 else if (mpfr_less_p (x_tmp.val, y_tmp.
val))
1720 #include "dpd/decimal128.h" 1721 #include "dpd/decimal64.h" 1722 #include "dpd/decimal32.h" 1726 #define MAX_DECIMAL_STRING 43 1740 #define OPPOSITE_BYTE_ORDER BFD_ENDIAN_LITTLE 1742 #define OPPOSITE_BYTE_ORDER BFD_ENDIAN_BIG 1746 for (i = 0; i < len; i++)
1747 to[i] = from[len - i - 1];
1749 for (i = 0; i < len; i++)
1765 decContextDefault (ctx, DEC_INIT_DECIMAL32);
1768 decContextDefault (ctx, DEC_INIT_DECIMAL64);
1771 decContextDefault (ctx, DEC_INIT_DECIMAL128);
1787 if (ctx->status & DEC_IEEE_854_Invalid_operation)
1790 ctx->status &= DEC_IEEE_854_Invalid_operation;
1791 error (
_(
"Cannot perform operation: %s"),
1792 decContextStatusToString (ctx));
1811 decimal32FromNumber ((decimal32 *) dec, from, &
set);
1814 decimal64FromNumber ((decimal64 *) dec, from, &
set);
1817 decimal128FromNumber ((decimal128 *) dec, from, &
set);
1820 error (
_(
"Unknown decimal floating point type."));
1839 decimal32ToNumber ((decimal32 *) dec, to);
1842 decimal64ToNumber ((decimal64 *) dec, to);
1845 decimal128ToNumber ((decimal128 *) dec, to);
1848 error (
_(
"Unknown decimal floating point type."));
1861 return decNumberIsZero (&number);
1872 const char *format)
const override;
1877 const struct type *
type)
const override;
1883 const struct type *
type)
const override 1890 double val)
const override 1897 gdb_byte *to,
const struct type *to_type)
const override;
1902 gdb_byte *res,
const struct type *type_res)
const override;
1904 const gdb_byte *y,
const struct type *type_y)
const override;
1912 const char *format =
nullptr)
const 1918 if (format !=
nullptr)
1923 #if defined (PRINTF_HAS_DECFLOAT) 1935 decimal32ToString ((decimal32 *) dec, &result[0]);
1938 decimal64ToString ((decimal64 *) dec, &result[0]);
1941 decimal128ToString ((decimal128 *) dec, &result[0]);
1944 error (
_(
"Unknown decimal floating point type."));
1966 decimal32FromString ((decimal32 *) dec,
string.c_str (), &
set);
1969 decimal64FromString ((decimal64 *) dec,
string.c_str (), &
set);
1972 decimal128FromString ((decimal128 *) dec,
string.c_str (), &
set);
1975 error (
_(
"Unknown decimal floating point type."));
1994 if ((int32_t) from != from)
1996 error (
_(
"Conversion of large integer to a " 1997 "decimal floating type is not supported."));
1999 decNumberFromInt32 (&number, (int32_t) from);
2011 if ((uint32_t) from != from)
2013 error (
_(
"Conversion of large integer to a " 2014 "decimal floating type is not supported."));
2016 decNumberFromUInt32 (&number, (uint32_t) from);
2029 return strtoll (str.c_str (), NULL, 10);
2042 decNumber number1, number2, number3;
2052 decNumberAdd (&number3, &number1, &number2, &
set);
2055 decNumberSubtract (&number3, &number1, &number2, &
set);
2058 decNumberMultiply (&number3, &number1, &number2, &
set);
2061 decNumberDivide (&number3, &number1, &number2, &
set);
2064 decNumberPower (&number3, &number1, &number2, &
set);
2067 error (
_(
"Operation not valid for decimal floating point number."));
2084 decNumber number1, number2, result;
2086 const struct type *type_result;
2095 decNumberCompare (&result, &number1, &number2, &
set);
2100 if (decNumberIsNaN (&result))
2101 error (
_(
"Comparison with an invalid number (NaN)."));
2102 else if (decNumberIsZero (&result))
2104 else if (decNumberIsNegative (&result))
2132 const struct type *type2)
2140 const struct type *type2)
2237 return &host_float_ops_float;
2243 return &host_float_ops_double;
2249 return &host_float_ops_long_double;
2263 return &binary_float_ops;
2344 if (!floatformat_is_valid (fmt, addr))
2345 return "<invalid float value>";
2445 ops->
convert (from, from_type, to, to_type);
2473 ops->
binop (opcode, x, type_x, y, type_y, res, type_res);
2490 return ops->
compare (x, type_x, y, type_y);
static size_t floatformat_totalsize_bytes(const struct floatformat *fmt)
LONGEST to_longest(const gdb_byte *addr, const struct type *type) const override
void from_longest(gdb_byte *addr, const struct type *type, LONGEST val) const override
std::string target_float_to_string(const gdb_byte *addr, const struct type *type, const char *format)
std::string to_string(const gdb_byte *addr, const struct type *type, const char *format) const override
void from_ulongest(gdb_byte *addr, const struct type *type, ULONGEST val) const override
static bool decimal_is_zero(const gdb_byte *addr, const struct type *type)
static void decimal_from_number(const decNumber *from, gdb_byte *to, const struct type *type)
bool target_float_is_zero(const gdb_byte *addr, const struct type *type)
virtual double to_host_double(const gdb_byte *addr, const struct type *type) const =0
static const struct floatformat * host_long_double_format
const struct floatformat * floatformat_from_type(const struct type *type)
static enum target_float_ops_kind get_target_float_ops_kind(const struct type *type)
double to_host_double(const gdb_byte *addr, const struct type *type) const override
static const char * floatformat_mantissa(const struct floatformat *fmt, const bfd_byte *val)
double to_host_double(const gdb_byte *addr, const struct type *type) const override
void binop(enum exp_opcode opcode, const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y, gdb_byte *res, const struct type *type_res) const override
static const target_float_ops * get_target_float_ops(enum target_float_ops_kind kind)
void * memset(T *s, int c, size_t n)=delete
static int floatformat_is_negative(const struct floatformat *fmt, const bfd_byte *uval)
void target_float_convert(const gdb_byte *from, const struct type *from_type, gdb_byte *to, const struct type *to_type)
static enum floatformat_byteorders floatformat_normalize_byteorder(const struct floatformat *fmt, const void *from, void *to)
#define GDB_HOST_DOUBLE_FORMAT
double target_float_to_host_double(const gdb_byte *addr, const struct type *type)
void convert(const gdb_byte *from, const struct type *from_type, gdb_byte *to, const struct type *to_type) const override
int compare(const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y) const override
void binop(enum exp_opcode opcode, const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y, gdb_byte *res, const struct type *type_res) const override
virtual void convert(const gdb_byte *from, const struct type *from_type, gdb_byte *to, const struct type *to_type) const =0
void from_longest(gdb_byte *addr, const struct type *type, LONGEST val) const override
void from_host_double(gdb_byte *addr, const struct type *type, double val) const override
void target_float_from_longest(gdb_byte *addr, const struct type *type, LONGEST val)
#define FLOATFORMAT_CHAR_BIT
static void match_endianness(const gdb_byte *from, const struct type *type, gdb_byte *to)
void binop(enum exp_opcode opcode, const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y, gdb_byte *res, const struct type *type_res) const override
bool from_string(gdb_byte *addr, const struct type *type, const std::string &string) const override
int compare(const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y) const override
LONGEST to_longest(const gdb_byte *addr, const struct type *type) const override
std::string to_string(const gdb_byte *addr, const struct type *type, const char *format) const override
static enum float_kind floatformat_classify(const struct floatformat *fmt, const bfd_byte *uval)
virtual LONGEST to_longest(const gdb_byte *addr, const struct type *type) const =0
virtual int compare(const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y) const =0
void from_host_double(gdb_byte *addr, const struct type *type, double val) const override
#define gdb_assert_not_reached(message)
static void decimal_to_number(const gdb_byte *addr, const struct type *type, decNumber *to)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
void from_host_double(gdb_byte *addr, const struct type *type, double val) const override
static void decimal_check_errors(decContext *ctx)
static std::string floatformat_printf_format(const struct floatformat *fmt, const char *format, char length)
void from_ulongest(gdb_byte *addr, const struct type *type, ULONGEST val) const override
bool target_float_from_string(gdb_byte *addr, const struct type *type, const std::string &string)
struct gdbarch * get_type_arch(const struct type *type)
void from_target(const struct floatformat *fmt, const gdb_byte *from, T *to) const
static bool target_float_same_format_p(const struct type *type1, const struct type *type2)
static int target_float_format_length(const struct type *type)
static unsigned long get_field(const bfd_byte *data, enum floatformat_byteorders order, unsigned int total_len, unsigned int start, unsigned int len)
#define GDB_HOST_FLOAT_FORMAT
virtual void from_host_double(gdb_byte *addr, const struct type *type, double val) const =0
static bool target_float_same_category_p(const struct type *type1, const struct type *type2)
void convert(const gdb_byte *from, const struct type *from_type, gdb_byte *to, const struct type *to_type) const override
void from_longest(gdb_byte *addr, const struct type *type, LONGEST val) const override
void target_float_from_ulongest(gdb_byte *addr, const struct type *type, ULONGEST val)
virtual bool from_string(gdb_byte *addr, const struct type *type, const std::string &string) const =0
gdb_mpfr(const gdb_mpfr &source)
virtual void from_longest(gdb_byte *addr, const struct type *type, LONGEST val) const =0
double to_host_double(const gdb_byte *addr, const struct type *type) const override
std::string to_string(const gdb_byte *addr, const struct type *type, const char *format) const override
void convert(const gdb_byte *from, const struct type *from_type, gdb_byte *to, const struct type *to_type) const override
void target_float_from_host_double(gdb_byte *addr, const struct type *type, double val)
void from_target(const struct floatformat *fmt, const gdb_byte *from, gdb_mpfr &to) const
static void put_field(unsigned char *data, enum floatformat_byteorders order, unsigned int total_len, unsigned int start, unsigned int len, unsigned long stuff_to_put)
virtual void binop(enum exp_opcode opcode, const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y, gdb_byte *res, const struct type *type_res) const =0
int compare(const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y) const override
int xsnprintf(char *str, size_t size, const char *format,...)
#define TYPE_CODE(thistype)
static void set_decnumber_context(decContext *ctx, const struct type *type)
void from_ulongest(gdb_byte *addr, const struct type *type, ULONGEST val) const override
char * safe_strerror(int)
gdb_mpfr(const struct type *type)
bool target_float_is_valid(const gdb_byte *addr, const struct type *type)
void to_target(const struct type *type, const T *from, gdb_byte *to) const
std::string string_printf(const char *fmt,...)
#define GDB_HOST_LONG_DOUBLE_FORMAT
bool from_string(gdb_byte *addr, const struct type *type, const std::string &string) const override
unsigned long long ULONGEST
int target_float_compare(const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y)
virtual void from_ulongest(gdb_byte *addr, const struct type *type, ULONGEST val) const =0
#define MAX_DECIMAL_STRING
static const struct floatformat * host_float_format
#define TYPE_LENGTH(thistype)
bool from_string(gdb_byte *addr, const struct type *type, const std::string &string) const override
static const struct floatformat * host_double_format
void to_target(const struct type *type, const gdb_mpfr &from, gdb_byte *to) const
void target_float_binop(enum exp_opcode opcode, const gdb_byte *x, const struct type *type_x, const gdb_byte *y, const struct type *type_y, gdb_byte *res, const struct type *type_res)
#define OPPOSITE_BYTE_ORDER
LONGEST target_float_to_longest(const gdb_byte *addr, const struct type *type)
static int floatformat_precision(const struct floatformat *fmt)
#define FLOATFORMAT_LARGEST_BYTES
void error(const char *fmt,...)
virtual std::string to_string(const gdb_byte *addr, const struct type *type, const char *format) const =0
LONGEST to_longest(const gdb_byte *addr, const struct type *type) const override