Let’s say I have this int variable v1:
1100 1010
And this variable int v2:
1001 1110
I need to copy the last four bits from v2 to the last four bits of v1 so that the result is:
1100 1110
^ ^ last four bits of v2
|
| first four bits of v1
How would I got about doing this in C or C++? I read a few articles about bitwise operations but I couldn’t find any information specifically about this.
Bitwise operations were the right things to look for.
Is there something specific you didn’t understand from the articles you read?