From: "François Dumont" <frs.dumont@gmail.com>
To: Jonathan Wakely <jwakely@redhat.com>,
Ed Smith-Rowland <3dw4rd@verizon.net>
Cc: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, libstdc++] More
Date: Tue, 26 Nov 2019 06:30:00 -0000 [thread overview]
Message-ID: <35aaf604-d496-5b01-703e-c294a5e9c38b@gmail.com> (raw)
In-Reply-To: <20191125211525.GG11522@redhat.com>
I have a patch for the same location so here is my remark that might
make my patch useless.
Maybe you can even merge it with yours Ed, here it is:
https://gcc.gnu.org/ml/libstdc++/2019-10/msg00072.html
On 11/25/19 10:15 PM, Jonathan Wakely wrote:
> On 15/11/19 22:17 -0500, Ed Smith-Rowland via libstdc++ wrote:
>> Index: include/bits/stl_algobase.h
>> ===================================================================
>> --- include/bits/stl_algobase.h   (revision 278318)
>> +++ include/bits/stl_algobase.h   (working copy)
>> @@ -107,6 +107,50 @@
>> Â Â Â }
>>
>> Â /*
>> +Â Â * A constexpr wrapper for __builtin_memmove.
>
> This should say __builtin_memcpy.
>
>> +Â Â * @param __num The number of elements of type _Tp (not bytes).
>> +Â Â */
>> +Â template<typename _Tp>
>> +Â Â Â _GLIBCXX14_CONSTEXPR
>> +Â Â Â inline void*
>> +Â Â Â __memcpy(_Tp* __dst, const _Tp* __src, size_t __num)
>> +Â Â Â {
>> +#ifdef __cpp_lib_is_constant_evaluated
>> +Â Â Â Â Â if (std::is_constant_evaluated())
>> +Â Â Â {
>> +Â Â Â Â Â for(; __num > 0; --__num)
for (; __num != 0; --__num)
and make __num prtdiff_t.
would be better here as this way the compiler is able to report bad
usages rather than silently do nothing.
>> +Â Â Â Â Â Â Â *__dst++ = *__src++;
>> +Â Â Â Â Â return __dst;
>> +Â Â Â }
>> +Â Â Â Â Â else
>> +#endif
>> +Â Â Â return __builtin_memcpy(__dst, __src, sizeof(_Tp) * __num);
>> +Â Â Â Â Â return __dst;
>> +Â Â Â }
>> +
>> +Â /*
>> +Â Â * A constexpr wrapper for __builtin_memmove.
>
> And this should say __builtin_memset.
>
>> +Â Â * @param __num The number of elements of type _Tp (not bytes).
>> +Â Â */
>> +Â template<typename _Tp>
>> +Â Â Â _GLIBCXX14_CONSTEXPR
>> +Â Â Â inline void*
>> +Â Â Â __memset(_Tp* __dst, _Tp __a, size_t __num)
>> +Â Â Â {
>> +#ifdef __cpp_lib_is_constant_evaluated
>> +Â Â Â Â Â if (std::is_constant_evaluated())
>> +Â Â Â {
>> +Â Â Â Â Â for(; __num > 0; --__num)
>> +Â Â Â Â Â Â Â *__dst = __a;
>> +Â Â Â Â Â return __dst;
>> +Â Â Â }
>> +Â Â Â Â Â else
>> +#endif
>> +Â Â Â return __builtin_memset(__dst, __a, sizeof(_Tp) * __num);
>> +Â Â Â Â Â return __dst;
>> +Â Â Â }
>
> OK for trunk with those two comment fixes. Thanks.
>
>
>
prev parent reply other threads:[~2019-11-26 6:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bb581959-8bd5-b603-ebf2-f7e2eaa512db.ref@verizon.net>
2019-11-16 3:17 ` Ed Smith-Rowland via libstdc++
2019-11-25 21:15 ` Jonathan Wakely
2019-11-26 6:30 ` François Dumont [this message]
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=35aaf604-d496-5b01-703e-c294a5e9c38b@gmail.com \
--to=frs.dumont@gmail.com \
--cc=3dw4rd@verizon.net \
--cc=gcc-patches@gcc.gnu.org \
--cc=jwakely@redhat.com \
--cc=libstdc++@gcc.gnu.org \
/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).