From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Improve comment on _Power_of_2 helper function
Date: Mon, 9 Nov 2020 14:55:00 +0000 [thread overview]
Message-ID: <20201109145500.GA3917724@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 180 bytes --]
libstdc++-v3/ChangeLog:
* include/bits/uniform_int_dist.h (__detail::_Power_of_2):
Document that true result for zero is intentional.
Tested x86_64-linux. Committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1025 bytes --]
commit b2b85163731e8647542f2f7561bd4c69ae5f5f2a
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Nov 9 14:32:45 2020
libstdc++: Improve comment on _Power_of_2 helper function
libstdc++-v3/ChangeLog:
* include/bits/uniform_int_dist.h (__detail::_Power_of_2):
Document that true result for zero is intentional.
diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h
index 8f02b85c9bb0..4169f705c2af 100644
--- a/libstdc++-v3/include/bits/uniform_int_dist.h
+++ b/libstdc++-v3/include/bits/uniform_int_dist.h
@@ -56,7 +56,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace __detail
{
- /* Determine whether number is a power of 2. */
+ // Determine whether number is a power of two.
+ // This is true for zero, which is OK because we want _Power_of_2(n+1)
+ // to be true if n==numeric_limits<_Tp>::max() and so n+1 wraps around.
template<typename _Tp>
constexpr bool
_Power_of_2(_Tp __x)
reply other threads:[~2020-11-09 14:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201109145500.GA3917724@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--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).