https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99396

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
so
      using __unsigned_type = __make_unsigned<_Tp>::__type;
      constexpr auto _Nd = __gnu_cxx::__int_traits<__unsigned_type>::__digits;
      const auto __r = static_cast<unsigned int>(__s);
      const auto __y = static_cast<__unsigned_type>(__x;
      const auto __z = (__y << (__r % _Nd)) | (__y >> ((-__r) % _Nd));
      return static_cast<_Tp>(__z);
?  Of course, if _Tp can be anything other than integral types, it would need
to be a specialization for integral types (though it will work for __int128
fine if that doesn't count as integral).

Reply via email to