/* Floating point routines for GDB, the GNU debugger.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
This file is part of GDB.
{
double dto;
- floatformat_to_double (fmt->split_half ? fmt->split_half : fmt,
- from, &dto);
+ floatformat_to_double /* ARI: floatformat_to_double */
+ (fmt->split_half ? fmt->split_half : fmt, from, &dto);
*to = (T) dto;
return;
}
static void
match_endianness (const gdb_byte *from, const struct type *type, gdb_byte *to)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_DECFLOAT);
+ gdb_assert (type->code () == TYPE_CODE_DECFLOAT);
int len = TYPE_LENGTH (type);
int i;
#define OPPOSITE_BYTE_ORDER BFD_ENDIAN_BIG
#endif
- if (gdbarch_byte_order (get_type_arch (type)) == OPPOSITE_BYTE_ORDER)
+ if (type_byte_order (type) == OPPOSITE_BYTE_ORDER)
for (i = 0; i < len; i++)
to[i] = from[len - i - 1];
else
static void
set_decnumber_context (decContext *ctx, const struct type *type)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_DECFLOAT);
+ gdb_assert (type->code () == TYPE_CODE_DECFLOAT);
switch (TYPE_LENGTH (type))
{
target_float_same_category_p (const struct type *type1,
const struct type *type2)
{
- return TYPE_CODE (type1) == TYPE_CODE (type2);
+ return type1->code () == type2->code ();
}
/* Return whether TYPE1 and TYPE2 use the same floating-point format. */
if (!target_float_same_category_p (type1, type2))
return false;
- switch (TYPE_CODE (type1))
+ switch (type1->code ())
{
case TYPE_CODE_FLT:
return floatformat_from_type (type1) == floatformat_from_type (type2);
case TYPE_CODE_DECFLOAT:
return (TYPE_LENGTH (type1) == TYPE_LENGTH (type2)
- && (gdbarch_byte_order (get_type_arch (type1))
- == gdbarch_byte_order (get_type_arch (type2))));
+ && (type_byte_order (type1)
+ == type_byte_order (type2)));
default:
gdb_assert_not_reached ("unexpected type code");
static int
target_float_format_length (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
return floatformat_totalsize_bytes (floatformat_from_type (type));
static enum target_float_ops_kind
get_target_float_ops_kind (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
{
static const target_float_ops *
get_target_float_ops (const struct type *type1, const struct type *type2)
{
- gdb_assert (TYPE_CODE (type1) == TYPE_CODE (type2));
+ gdb_assert (type1->code () == type2->code ());
enum target_float_ops_kind kind1 = get_target_float_ops_kind (type1);
enum target_float_ops_kind kind2 = get_target_float_ops_kind (type2);
bool
target_float_is_valid (const gdb_byte *addr, const struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
return floatformat_is_valid (floatformat_from_type (type), addr);
- if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ if (type->code () == TYPE_CODE_DECFLOAT)
return true;
gdb_assert_not_reached ("unexpected type code");
bool
target_float_is_zero (const gdb_byte *addr, const struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
return (floatformat_classify (floatformat_from_type (type), addr)
== float_zero);
- if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ if (type->code () == TYPE_CODE_DECFLOAT)
return decimal_is_zero (addr, type);
gdb_assert_not_reached ("unexpected type code");
{
/* Unless we need to adhere to a specific format, provide special
output for special cases of binary floating-point numbers. */
- if (format == nullptr && TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (format == nullptr && type->code () == TYPE_CODE_FLT)
{
const struct floatformat *fmt = floatformat_from_type (type);