Files
2025-10-25 03:02:53 +03:00

1.8 KiB
Raw Permalink Blame History

[bit.rotate]

22 General utilities library [utilities]

22.11 Bit manipulation [bit]

22.11.6 Rotating [bit.rotate]

1

#

In the following descriptions, let N denote numeric_limits::digits.

🔗

template<class T> constexpr T rotl(T x, int s) noexcept;

2

#

Constraints: T is an unsigned integer type ([basic.fundamental]).

3

#

Let r be s % N.

4

#

Returns: If r is 0, x; if r is positive, (x << r) | (x >> (N - r)); if r is negative, rotr(x, -r).

🔗

template<class T> constexpr T rotr(T x, int s) noexcept;

5

#

Constraints: T is an unsigned integer type ([basic.fundamental]).

6

#

Let r be s % N.

7

#

Returns: If r is 0, x; if r is positive, (x >> r) | (x << (N - r)); if r is negative, rotl(x, -r).