C++ Logo


Advanced search

Re: Setting wording for bit manipulation for non-binary hardware

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sat, 6 Mar 2021 14:34:36 -0500
On Sat, Mar 6, 2021 at 12:55 PM Vishal Oza via Std-Discussion
<std-discussion_at_[hidden]> wrote:
> I was thinking of making the bit and bitset libraries as well bit manipulation operators with the exception of endian and possibly left and right bitshift to undefined behavior if the base is not 2 in hardware.

Um, what exactly does that mean?

Here's what I mean. If you have the number 15, and you do a
binary-left-shift it by 2, the number you get is 30. It *does not
matter* how the hardware implements this. So long as `30 == 15 << 2`
is true, the implementation is doing its job.

Similarly, if you have the number 15, and you do a bitwise-and with 2,
you get the number 13. Again, how the hardware does this is
irrelevant; the implementation's job is to make the math work out.

> Most computer hardware uses base 2 but I am thinking of creating specialized hardware that is used to determine if a number is most likely not prime by setting the base to 6 rather than 2 as this can guarantee primes less than 36 and might be reasonable for primes greater than 36. This might also be useful for quantum computing.
> I just wanted to see if there is any interest in this proposal.

This is the wrong mailing list for "should this be a proposal" type
things. You're looking for the "std-proposals" list.

That being said, considering what I said above, you need an
explanation for why hardware that is base 6 can't implement the
standard as is.

Received on 2021-03-06 13:34:49