diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2018-07-04 15:31:56 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-07-04 15:31:56 +0100 |
commit | 4e4120a27ac1e2abd4a5309aefcc4ba0dac45784 (patch) | |
tree | f2bfed3bea03c6cbbd252327a504a797f47b640a /libstdc++-v3/include/std | |
parent | 04f8c98c5137cf912095bc623e09b34616fc2fe8 (diff) | |
download | gcc-4e4120a27ac1e2abd4a5309aefcc4ba0dac45784.zip gcc-4e4120a27ac1e2abd4a5309aefcc4ba0dac45784.tar.gz gcc-4e4120a27ac1e2abd4a5309aefcc4ba0dac45784.tar.bz2 |
Fix std::__rotl and std::__rotr
2018-07-04 Jonathan Wakely <jwakely@redhat.com>
Jakub Jelinek <jakub@redhat.com>
* include/std/bit (__rotl, __rotr): Fix for non-power of two sizes.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r262414
Diffstat (limited to 'libstdc++-v3/include/std')
-rw-r--r-- | libstdc++-v3/include/std/bit | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit index ace8895..a23f2ba 100644 --- a/libstdc++-v3/include/std/bit +++ b/libstdc++-v3/include/std/bit @@ -46,7 +46,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { constexpr auto _Nd = numeric_limits<_Tp>::digits; const unsigned __sN = __s % _Nd; - return (__x << __sN) | (__x >> ((-__sN) % _Nd)); + return (__x << __sN) | (__x >> ((_Nd - __sN) % _Nd)); } template<typename _Tp> @@ -55,7 +55,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { constexpr auto _Nd = numeric_limits<_Tp>::digits; const unsigned __sN = __s % _Nd; - return (__x >> __sN) | (__x << ((-__sN) % _Nd)); + return (__x >> __sN) | (__x << ((_Nd - __sN) % _Nd)); } template<typename _Tp> |