]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Use unsigned division in std::rotate [PR113811]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 8 Feb 2024 15:40:32 +0000 (15:40 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 15 Feb 2024 11:43:21 +0000 (11:43 +0000)
commit4d819db7f229a23cb15ef68f310e0bb51d201c45
tree0f8e096528c7512cb79d029a578eb46793ab5dae
parentb58f0e5216a3053486e7f1aa96c3f2443b14d630
libstdc++: Use unsigned division in std::rotate [PR113811]

Signed 64-bit division is much slower than unsigned, so cast the n and
k values to unsigned before doing n %= k. We know this is safe because
neither value can be negative.

libstdc++-v3/ChangeLog:

PR libstdc++/113811
* include/bits/stl_algo.h (__rotate): Use unsigned values for
division.
libstdc++-v3/include/bits/stl_algo.h