For example:
input 0
should give 0xffffffff
(i.e. all ones)
input 1
should give 0xfffffffe
(31 ones followed by one zero)
input 32
should give 0x80000000
(a single one followed by 31 zeroes)
Looking for minimal gate usage & preferably short length. My current solution is to decode the input and chain OR's, with one bit's output feeding into the next OR. I feel like this is nowhere near optimal, but couldn't figure out how to improve upon it.
User contributions licensed under CC BY-SA 3.0