diff options
author | Tom Tromey <tromey@adacore.com> | 2023-02-23 07:30:26 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-03-14 08:16:39 -0600 |
commit | 302273ca843fc3ddbe8210e6d30459316bf04f0e (patch) | |
tree | 93807817bec50bb5d5700fdfb3f6603b0907ce0e /gdb/ada-lex.l | |
parent | c8a67010d133374dfb3b4ed88da7953702a2091d (diff) | |
download | gdb-302273ca843fc3ddbe8210e6d30459316bf04f0e.zip gdb-302273ca843fc3ddbe8210e6d30459316bf04f0e.tar.gz gdb-302273ca843fc3ddbe8210e6d30459316bf04f0e.tar.bz2 |
Add methods and operators to gdb_mpz
This adds various methods and operators to gdb_mpz, as a step toward
hiding the implementation.
This only adds the operators that were needed. Many more could be
added as required.
Diffstat (limited to 'gdb/ada-lex.l')
-rw-r--r-- | gdb/ada-lex.l | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index a5cfb84..69fc14f 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -422,14 +422,14 @@ processInt (struct parser_state *par_state, const char *base0, int dig = fromhex (*num0); if (dig >= base) error (_("Invalid digit `%c' in based literal"), *num0); - mpz_mul_ui (result.val, result.val, base); - mpz_add_ui (result.val, result.val, dig); + result *= base; + result += dig; ++num0; } while (exp > 0) { - mpz_mul_ui (result.val, result.val, base); + result *= base; exp -= 1; } @@ -462,8 +462,7 @@ processInt (struct parser_state *par_state, const char *base0, return FLOAT; } - gdb_mpz maxval (ULONGEST_MAX); - if (mpz_cmp (result.val, maxval.val) > 0) + if (result > gdb_mpz (ULONGEST_MAX)) error (_("Integer literal out of range")); int int_bits = gdbarch_int_bit (par_state->gdbarch ()); |