Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int InsertNumberIntoAnother(int destinationNumber, int sourceNumber, int i, int j)
- {
- sourceNumber <<= 31 - j + i;
- sourceNumber >>= 31 - j;
- uint mask = uint.MaxValue;
- mask >>= 31 - j + i;
- mask <<= i;
- mask = ~mask;
- destinationNumber &= (int)mask;
- destinationNumber |= sourceNumber;
- return destinationNumber;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement