<p>I was reading Joel's book where he was suggesting as interview question:</p>

<blockquote>
  <p>Write a program to reverse the "ON" bits in a given byte.</p>
</blockquote>

<p>I only can think of a solution using C. </p>

<p>Asking here so you can show me how to do in a Non C way (if possible)</p>

What specifically does that question mean?
Does
reverse
mean setting 1's to 0's and vice versa?
Or does it mean
00001100
-->
00110000
where you reverse their order in the byte? Or perhaps just reversing the part that is from the first 1 to the last 1? ie.
00110101
-->
00101011
?
Assuming it means reversing the bit order in the whole byte, here's an x86 assembler version:
```
```
; al is input register
; bl is output register

xor bl, bl      ; clear output

; first bit
rcl al, 1       ; rotate al through carry
rcr bl, 1       ; rotate carry into bl

; duplicate above 2-line statements 7 more times for the other bits
```
```
not the most optimal solution, a table lookup is faster.