stoneharry

Untitled

Sep 24th, 2013
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1.     template <T> Shift (T left, int32 right)
  2.     {
  3.         if (typeof (T).Name == "Int32")
  4.             return Convert.ToInt32(left) >> right;
  5.  
  6.         if (typeof (T).Name == "UInt32")
  7.             return (int) (Convert.ToUInt32(left) >> right);
  8.  
  9.         return 0;
  10.     }
  11.  
  12. /*
  13.         private static int Shift<T>(T left, int right)
  14.         {
  15.             if (typeof (T).Name == "Int32")
  16.                 return Convert.ToInt32(left) >> right;
  17.  
  18.             if (typeof (T).Name == "UInt32")
  19.                 return (int) (Convert.ToUInt32(left) >> right);
  20.  
  21.             return 0;
  22.         }
  23. */
  24.  
  25. void WriteBits<T>(T valz, int32 numBits);
Advertisement
Add Comment
Please, Sign In to add comment