Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1.         public Guid ReadPackedGuid()
  2.         {
  3.             var mask = ReadByte();
  4.  
  5.             if (mask == 0)
  6.                 return new Guid(0);
  7.  
  8.             ulong res = 0;
  9.  
  10.             var i = 0;
  11.             while (i < 8)
  12.             {
  13.                 if ((mask & 1 << i) != 0)
  14.                     res += (ulong)ReadByte() << (i * 8);
  15.  
  16.                 i++;
  17.             }
  18.  
  19.             return new Guid(res);
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement