Date: Fri, 27 Jun 2025 08:49:58 +0200
> I’ve used a version of all of these, semi-regularly.
> However, they are so trivial to implement that it has never occurred to me to write a function to do those.
How do you write sign_fill usually then? Do you just use ">>
(std::numeric_limits<T>::digits - 1)" in every place where you
sign-fill?
> It might be easier to sell these by packaging them with a set of bit operations,
> like a shift out (i.e. left or right shift overflow bits goes into a separate integer),
> mask multiple bits, bit order swaps, etc…
I'm not sure what you mean by "mask multiple bits"; that sounds much
like bit_mask, which is on the list.
bit_reverse (bit order swaps) is design-approved for C++29 as part of
Bit permutations already.
obtaining the shifted-out bits sounds interesting. That's useful for
bit-shifting numbers in multi-precision arithmetic.
> However, they are so trivial to implement that it has never occurred to me to write a function to do those.
How do you write sign_fill usually then? Do you just use ">>
(std::numeric_limits<T>::digits - 1)" in every place where you
sign-fill?
> It might be easier to sell these by packaging them with a set of bit operations,
> like a shift out (i.e. left or right shift overflow bits goes into a separate integer),
> mask multiple bits, bit order swaps, etc…
I'm not sure what you mean by "mask multiple bits"; that sounds much
like bit_mask, which is on the list.
bit_reverse (bit order swaps) is design-approved for C++29 as part of
Bit permutations already.
obtaining the shifted-out bits sounds interesting. That's useful for
bit-shifting numbers in multi-precision arithmetic.
Received on 2025-06-27 06:50:13