]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Improve comment on _Power_of_2 helper function
authorJonathan Wakely <jwakely@redhat.com>
Mon, 9 Nov 2020 14:32:45 +0000 (14:32 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 9 Nov 2020 14:54:29 +0000 (14:54 +0000)
libstdc++-v3/ChangeLog:

* include/bits/uniform_int_dist.h (__detail::_Power_of_2):
Document that true result for zero is intentional.

libstdc++-v3/include/bits/uniform_int_dist.h

index 8f02b85c9bb0884a59bd2190fa668e507e9e1f1f..4169f705c2af72917e7b43d5503d2853d1dc2fa4 100644 (file)
@@ -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)
This page took 0.063568 seconds and 5 git commands to generate.