tmp/tmp90rn_3ih/{from.md → to.md}
RENAMED
|
@@ -7,20 +7,19 @@ operators, as an integer type, or as a `bitset` ([[template.bitset]]).
|
|
| 7 |
|
| 8 |
The bitmask type *bitmask* can be written:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
// For exposition only.
|
| 12 |
-
// int_type is an integral type capable of
|
| 13 |
-
// representing all values of the bitmask type.
|
| 14 |
enum bitmask : int_type {
|
| 15 |
-
|
| 16 |
};
|
| 17 |
|
| 18 |
-
constexpr bitmask
|
| 19 |
-
constexpr bitmask
|
| 20 |
-
constexpr bitmask
|
| 21 |
-
constexpr bitmask
|
| 22 |
.....
|
| 23 |
|
| 24 |
constexpr bitmask{} operator&(bitmask{} X, bitmask{} Y) {
|
| 25 |
return static_cast<bitmask{}>(
|
| 26 |
static_cast<int_type>(X) & static_cast<int_type>(Y));
|
|
@@ -45,14 +44,14 @@ bitmask{}& operator|=(bitmask{}& X, bitmask{} Y) {
|
|
| 45 |
bitmask{}& operator^=(bitmask{}& X, bitmask{} Y) {
|
| 46 |
X = X ^ Y; return X;
|
| 47 |
}
|
| 48 |
```
|
| 49 |
|
| 50 |
-
Here, the names
|
| 51 |
particular bitmask type. All such elements have distinct, nonzero values
|
| 52 |
-
such that, for any pair
|
| 53 |
-
nonzero and
|
| 54 |
represent an *empty bitmask*, in which no bitmask elements are set.
|
| 55 |
|
| 56 |
The following terms apply to objects and values of bitmask types:
|
| 57 |
|
| 58 |
- To *set* a value *Y* in an object *X* is to evaluate the expression
|
|
|
|
| 7 |
|
| 8 |
The bitmask type *bitmask* can be written:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
// For exposition only.
|
| 12 |
+
// int_type is an integral type capable of representing all values of the bitmask type.
|
|
|
|
| 13 |
enum bitmask : int_type {
|
| 14 |
+
V₀ = 1 << 0, V₁ = 1 << 1, V₂ = 1 << 2, V₃ = 1 << 3, .....
|
| 15 |
};
|
| 16 |
|
| 17 |
+
inline constexpr bitmask C₀(V₀{});
|
| 18 |
+
inline constexpr bitmask C₁(V₁{});
|
| 19 |
+
inline constexpr bitmask C₂(V₂{});
|
| 20 |
+
inline constexpr bitmask C₃(V₃{});
|
| 21 |
.....
|
| 22 |
|
| 23 |
constexpr bitmask{} operator&(bitmask{} X, bitmask{} Y) {
|
| 24 |
return static_cast<bitmask{}>(
|
| 25 |
static_cast<int_type>(X) & static_cast<int_type>(Y));
|
|
|
|
| 44 |
bitmask{}& operator^=(bitmask{}& X, bitmask{} Y) {
|
| 45 |
X = X ^ Y; return X;
|
| 46 |
}
|
| 47 |
```
|
| 48 |
|
| 49 |
+
Here, the names `C₀`, `C₁`, etc. represent *bitmask elements* for this
|
| 50 |
particular bitmask type. All such elements have distinct, nonzero values
|
| 51 |
+
such that, for any pair `Cᵢ` and `Cⱼ` where i ≠ j, `C_i & C_i` is
|
| 52 |
+
nonzero and `C_i & C_j` is zero. Additionally, the value `0` is used to
|
| 53 |
represent an *empty bitmask*, in which no bitmask elements are set.
|
| 54 |
|
| 55 |
The following terms apply to objects and values of bitmask types:
|
| 56 |
|
| 57 |
- To *set* a value *Y* in an object *X* is to evaluate the expression
|