Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
eg:10010110
apply not operation to 1st,3rd,5th,7th position from right to left
Posted

1 solution

Use XOR operator with a mask having value one in the position of bits to invert and zero for bits to leave unchanged.
10010110 XOR 10101010 = 0011100
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900