tmp/tmpk5vm145u/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Rotating <a id="bit.rotate">[[bit.rotate]]</a>
|
| 2 |
+
|
| 3 |
+
In the following descriptions, let `N` denote
|
| 4 |
+
`numeric_limits<T>::digits`.
|
| 5 |
+
|
| 6 |
+
``` cpp
|
| 7 |
+
template<class T>
|
| 8 |
+
[[nodiscard]] constexpr T rotl(T x, int s) noexcept;
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
*Constraints:* `T` is an unsigned integer type [[basic.fundamental]].
|
| 12 |
+
|
| 13 |
+
Let `r` be `s % N`.
|
| 14 |
+
|
| 15 |
+
*Returns:* If `r` is `0`, `x`; if `r` is positive,
|
| 16 |
+
`(x << r) | (x >> (N - r))`; if `r` is negative, `rotr(x, -r)`.
|
| 17 |
+
|
| 18 |
+
``` cpp
|
| 19 |
+
template<class T>
|
| 20 |
+
[[nodiscard]] constexpr T rotr(T x, int s) noexcept;
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
*Constraints:* `T` is an unsigned integer type [[basic.fundamental]].
|
| 24 |
+
|
| 25 |
+
Let `r` be `s % N`.
|
| 26 |
+
|
| 27 |
+
*Returns:* If `r` is `0`, `x`; if `r` is positive,
|
| 28 |
+
`(x >> r) | (x << (N - r))`; if `r` is negative, `rotl(x, -r)`.
|
| 29 |
+
|