tmp/tmpatb2t69h/{from.md → to.md}
RENAMED
|
@@ -23,26 +23,38 @@ into the available space, otherwise the adjusted value of `ptr`.
|
|
| 23 |
it can be called repeatedly with possibly different `alignment` and
|
| 24 |
`size` arguments for the same buffer. — *end note*]
|
| 25 |
|
| 26 |
``` cpp
|
| 27 |
template<size_t N, class T>
|
| 28 |
-
|
| 29 |
```
|
| 30 |
|
| 31 |
*Mandates:* `N` is a power of two.
|
| 32 |
|
| 33 |
-
*Preconditions:* `ptr` points to an object
|
| 34 |
-
similar [[conv.qual]] to `T`, where
|
| 35 |
-
[[basic.align]].
|
| 36 |
|
| 37 |
*Returns:* `ptr`.
|
| 38 |
|
| 39 |
*Throws:* Nothing.
|
| 40 |
|
| 41 |
-
[*Note 2*: The alignment assumption on an object
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
`assume_aligned`. — *end note*]
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
it can be called repeatedly with possibly different `alignment` and
|
| 24 |
`size` arguments for the same buffer. — *end note*]
|
| 25 |
|
| 26 |
``` cpp
|
| 27 |
template<size_t N, class T>
|
| 28 |
+
constexpr T* assume_aligned(T* ptr);
|
| 29 |
```
|
| 30 |
|
| 31 |
*Mandates:* `N` is a power of two.
|
| 32 |
|
| 33 |
+
*Preconditions:* `ptr` points to an object X of a type
|
| 34 |
+
similar [[conv.qual]] to `T`, where X has alignment `N` [[basic.align]].
|
|
|
|
| 35 |
|
| 36 |
*Returns:* `ptr`.
|
| 37 |
|
| 38 |
*Throws:* Nothing.
|
| 39 |
|
| 40 |
+
[*Note 2*: The alignment assumption on an object X expressed by a call
|
| 41 |
+
to `assume_aligned` might result in generation of more efficient code.
|
| 42 |
+
It is up to the program to ensure that the assumption actually holds.
|
| 43 |
+
The call does not cause the implementation to verify or enforce this. An
|
| 44 |
+
implementation might only make the assumption for those operations on X
|
| 45 |
+
that access X through the pointer returned by
|
| 46 |
`assume_aligned`. — *end note*]
|
| 47 |
|
| 48 |
+
``` cpp
|
| 49 |
+
template<size_t Alignment, class T>
|
| 50 |
+
bool is_sufficiently_aligned(T* ptr);
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
*Preconditions:* `p` points to an object `X` of a type
|
| 54 |
+
similar [[conv.qual]] to `T`.
|
| 55 |
+
|
| 56 |
+
*Returns:* `true` if `X` has alignment at least `Alignment`, otherwise
|
| 57 |
+
`false`.
|
| 58 |
+
|
| 59 |
+
*Throws:* Nothing.
|
| 60 |
+
|