From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: rep.dot.nop@gmail.com, Aldy Hernandez <aldyh@redhat.com>,
Andrew MacLeod <amacleod@redhat.com>,
Richard Biener <richard.guenther@gmail.com>,
Jakub Jelinek <jakub@redhat.com>,
mjambor@suse.cz
Subject: Re: [PATCH] Add auto-resizing capability to irange's [PR109695]
Date: Mon, 15 May 2023 16:24:53 +0200 [thread overview]
Message-ID: <20230515162453.4f2a5e94@nbbrfq.loc> (raw)
In-Reply-To: <20230515103523.100412-1-aldyh@redhat.com>
On Mon, 15 May 2023 12:35:23 +0200
Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> +// For resizable ranges, resize the range up to HARD_MAX_RANGES if the
> +// NEEDED pairs is greater than the current capacity of the range.
> +
> +inline void
> +irange::maybe_resize (int needed)
> +{
> + if (!m_resizable || m_max_ranges == HARD_MAX_RANGES)
> + return;
> +
> + if (needed > m_max_ranges)
> + {
> + m_max_ranges = HARD_MAX_RANGES;
> + wide_int *newmem = new wide_int[m_max_ranges * 2];
> + memcpy (newmem, m_base, sizeof (wide_int) * num_pairs () * 2);
> + m_base = newmem;
Please excuse my ignorance, but where's the old m_base freed? I think
the assignment above does not call the destructor, or does it?
thanks,
> + }
> +}
> +
> +template<unsigned N, bool RESIZABLE>
> +inline
> +int_range<N, RESIZABLE>::~int_range ()
> +{
> + if (RESIZABLE && m_base != m_ranges)
> + delete m_base;
> +}
next prev parent reply other threads:[~2023-05-15 14:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 10:35 Aldy Hernandez
2023-05-15 10:42 ` Jakub Jelinek
2023-05-15 15:07 ` Aldy Hernandez
2023-05-15 18:14 ` Aldy Hernandez
2023-05-16 9:24 ` Aldy Hernandez
2023-05-15 11:08 ` Richard Biener
2023-05-15 11:26 ` Jakub Jelinek
2023-05-15 15:03 ` Aldy Hernandez
2023-05-15 17:23 ` Aldy Hernandez
2023-05-15 14:24 ` Bernhard Reutner-Fischer [this message]
2023-05-15 14:27 ` Aldy Hernandez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230515162453.4f2a5e94@nbbrfq.loc \
--to=rep.dot.nop@gmail.com \
--cc=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=mjambor@suse.cz \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).