Advertisement
yahorrr

Untitled

Sep 13th, 2022
907
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. public static int InsertNumberIntoAnother(int destinationNumber, int sourceNumber, int i, int j)
  2.         {
  3.             sourceNumber <<= 31 - j + i;
  4.             sourceNumber >>= 31 - j;
  5.             uint mask = uint.MaxValue;
  6.             mask >>= 31 - j + i;
  7.             mask <<= i;
  8.             mask = ~mask;
  9.             destinationNumber &= (int)mask;
  10.             destinationNumber |= sourceNumber;
  11.  
  12.             return destinationNumber;
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement