Recently I wondered if it's possible to save a few cycles. It turns out the bits are at most 3 rotations away from their position in the reverse:

7

6

5

4

3

2

1

0

⇐1

⇐3

3⇒

1⇒

⇐1

⇐3

3⇒

1⇒

0

1

2

3

4

5

6

7

With this in mind I devised a bit-twiddling hack to reverse the bits in about a third of the time using only 6 rotates and a bit of logic to recombine the rotated bits. Here's the code, which no doubt has been done many times before:

If speed is the real issue, the (usually) fastest way to deal with bits in a byte (reverse bits, count bits set/clear, determine the first bit set/clear) is to pre-load a table with all 256 possible values and then use the byte in question to index into the table for the result.