aboutsummaryrefslogtreecommitdiff
path: root/gdb/gmp-utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gmp-utils.h')
-rw-r--r--gdb/gmp-utils.h32
1 files changed, 18 insertions, 14 deletions
diff --git a/gdb/gmp-utils.h b/gdb/gmp-utils.h
index 59965e5..12e4f8e 100644
--- a/gdb/gmp-utils.h
+++ b/gdb/gmp-utils.h
@@ -96,17 +96,19 @@ struct gdb_mpz
The return type can signed or unsigned, with no size restriction. */
template<typename T> T as_integer () const;
- /* Set VAL by importing the number stored in the byte buffer (BUF),
- given its size (LEN) and BYTE_ORDER.
+ /* Set VAL by importing the number stored in the byte array (BUF),
+ using the given BYTE_ORDER. The size of the data to read is
+ the byte array's size.
UNSIGNED_P indicates whether the number has an unsigned type. */
- void read (const gdb_byte *buf, int len, enum bfd_endian byte_order,
+ void read (gdb::array_view<const gdb_byte> buf, enum bfd_endian byte_order,
bool unsigned_p);
- /* Write VAL into BUF as a LEN-bytes number with the given BYTE_ORDER.
+ /* Write VAL into BUF as a number whose byte size is the size of BUF,
+ using the given BYTE_ORDER.
UNSIGNED_P indicates whether the number has an unsigned type. */
- void write (gdb_byte *buf, int len, enum bfd_endian byte_order,
+ void write (gdb::array_view<gdb_byte> buf, enum bfd_endian byte_order,
bool unsigned_p) const;
/* Return a string containing VAL. */
@@ -167,24 +169,26 @@ struct gdb_mpq
/* Return VAL rounded to the nearest integer. */
gdb_mpz get_rounded () const;
- /* Set VAL from the contents of the given buffer (BUF), which
- contains the unscaled value of a fixed point type object
- with the given size (LEN) and byte order (BYTE_ORDER).
+ /* Set VAL from the contents of the given byte array (BUF), which
+ contains the unscaled value of a fixed point type object.
+ The byte size of the data is the size of BUF.
+
+ BYTE_ORDER provides the byte_order to use when reading the data.
UNSIGNED_P indicates whether the number has an unsigned type.
SCALING_FACTOR is the scaling factor to apply after having
read the unscaled value from our buffer. */
- void read_fixed_point (const gdb_byte *buf, int len,
+ void read_fixed_point (gdb::array_view<const gdb_byte> buf,
enum bfd_endian byte_order, bool unsigned_p,
const gdb_mpq &scaling_factor);
- /* Write VAL into BUF as a LEN-bytes fixed point value following
- the given BYTE_ORDER.
+ /* Write VAL into BUF as fixed point value following the given BYTE_ORDER.
+ The size of BUF is used as the length to write the value into.
UNSIGNED_P indicates whether the number has an unsigned type.
SCALING_FACTOR is the scaling factor to apply before writing
the unscaled value to our buffer. */
- void write_fixed_point (gdb_byte *buf, int len,
+ void write_fixed_point (gdb::array_view<gdb_byte> buf,
enum bfd_endian byte_order, bool unsigned_p,
const gdb_mpq &scaling_factor) const;
@@ -213,13 +217,13 @@ struct gdb_mpf
UNSIGNED_P indicates whether the number has an unsigned type.
SCALING_FACTOR is the scaling factor to apply after having
read the unscaled value from our buffer. */
- void read_fixed_point (const gdb_byte *buf, int len,
+ void read_fixed_point (gdb::array_view<const gdb_byte> buf,
enum bfd_endian byte_order, bool unsigned_p,
const gdb_mpq &scaling_factor)
{
gdb_mpq tmp_q;
- tmp_q.read_fixed_point (buf, len, byte_order, unsigned_p, scaling_factor);
+ tmp_q.read_fixed_point (buf, byte_order, unsigned_p, scaling_factor);
mpf_set_q (val, tmp_q.val);
}