diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-11-09 14:32:45 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-11-09 14:54:29 +0000 |
commit | b2b85163731e8647542f2f7561bd4c69ae5f5f2a (patch) | |
tree | ac9deb788db34a06bc2a2993fc21cb54c342ecca | |
parent | ff4bfb1553cf525d7299bbf7451ac32cfd97ae1b (diff) | |
download | gcc-b2b85163731e8647542f2f7561bd4c69ae5f5f2a.zip gcc-b2b85163731e8647542f2f7561bd4c69ae5f5f2a.tar.gz gcc-b2b85163731e8647542f2f7561bd4c69ae5f5f2a.tar.bz2 |
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.
-rw-r--r-- | libstdc++-v3/include/bits/uniform_int_dist.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h index 8f02b85..4169f70 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) |