Let's say I have two binary numbers 00110010 and 11101110, and I would like to copy the last 4 values from second to the first to form a binary number of 00111110. Is there clean way to do this using bitwise operations on two bytes (or larger datatypes). Assume binary packed datatypes.
Also, is there a generic solution to this problem where any subset can be copied over. Let's say I wanted to copy some middle 3 bits from one number to another, what's the best way to accomplish this?