Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27355

Inverting Bits

$
0
0
Hi,

I am trying to find a way to invert the lower 4 bits of a byte. For example, I need to convert:

0x64 (0110 0100) to 0x6B (0110 1011)

I can do it with what I think is an unreasonable amount of code. Lots of if statements and a loop.

Is there an easier way using bitwise operators?

Thanks

Sonny

Viewing all articles
Browse latest Browse all 27355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>