The current wording of low level bit manipulation functions specified by "P0553R4: Bit operations" and by "P0556R3: Integral power-of-2 operations" make these functions unusable with std::byte. Since the whole purpose of the introduction of std::byte was to break the ambiguity between pure integers vs memory storage, the incompatibility between low level bit functions and std::byte reintroduces this pre-C++17 ambiguity for users. The current design may make future evolution of the header more complicated.
Proposed change:
Introduce a machine word “concept” as well as related type traits (binary_digits, is_word) that unsigned integers, extended unsigned integers, and std::byte satisfy. This mechanism should also constitute a customization point for advanced users who want to provide their own words types. Have the low-level bit operations take machine words as inputs and not only unsigned integers. See paper P1856R1. cplusplus/papers#610
The current wording of low level bit manipulation functions specified by "P0553R4: Bit operations" and by "P0556R3: Integral power-of-2 operations" make these functions unusable with std::byte. Since the whole purpose of the introduction of std::byte was to break the ambiguity between pure integers vs memory storage, the incompatibility between low level bit functions and std::byte reintroduces this pre-C++17 ambiguity for users. The current design may make future evolution of the header more complicated.
Proposed change: Introduce a machine word “concept” as well as related type traits (binary_digits, is_word) that unsigned integers, extended unsigned integers, and std::byte satisfy. This mechanism should also constitute a customization point for advanced users who want to provide their own words types. Have the low-level bit operations take machine words as inputs and not only unsigned integers. See paper P1856R1. cplusplus/papers#610