Advertisement
anilak

C#1_3_14

May 15th, 2013
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. using System;
  2.  
  3. class ExchangeBits345
  4. {
  5.     static void Main()
  6.     {
  7.         int p = 3;
  8.         int q = 24;
  9.         int k = 3;
  10.         uint i = 109051924;        
  11.         uint mask = 1;
  12.         uint t;
  13.         uint r;                  //result:41943092
  14.         t = ((i >> p) ^ (i >> q)) & ((mask << k) - 1);
  15.         r = i ^ ((t << p) | (t << q));
  16.         Console.WriteLine(r);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement