0
Bit reverse an 8 bit number in C++
I can only use xor, and, add, sub and bitshift left. These limitations are making it hard for me to find a solution. JUst some random code here that I've attempted: num sum = 0 for i = 0, i < 8; i++ { code attempt here: https://code.sololearn.com/cZjjIHO2a1c2 bit = (num >> i) & 1 // extract the ith bit, not sure how to bitshift right without using >> xor bit 1 bit << (8 - i)
2 odpowiedzi
0
"I can only use xor, and, add, sub and bitshift left."
Why?
"JUst some random code here that I've attempted:"
Put it in Code Playground, save as public, and link in the question. Way better to debug and fix.
0
it is for homework and i am limited to those.
link is here: sorry i am new to posting
https://code.sololearn.com/cZjjIHO2a1c2