SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.4 KiB

4 years ago
  1. using System;
  2. namespace UnityEngine.XR.ARSubsystems
  3. {
  4. /// <summary>
  5. /// Utility for dealing with <c>Guid</c>s.
  6. /// </summary>
  7. public static class GuidUtil
  8. {
  9. /// <summary>
  10. /// Reconstructs a <c>Guid</c> from two <c>ulong</c>s representing the low and high bytes.
  11. /// Use <c>UnityEditor.XR.ARSubsystems.GuidExtensions.Decompose</c> to decompose the guid
  12. /// into its low and high components.
  13. /// </summary>
  14. /// <param name="low">The low 8 bytes of the guid</param>
  15. /// <param name="high">The high 8 bytes of the guid.</param>
  16. /// <returns>The Guid composed of <paramref name="low"/> and <paramref name="high"/>.</returns>
  17. public static Guid Compose(ulong low, ulong high)
  18. {
  19. return new Guid(
  20. (uint)((low & 0x00000000ffffffff) >> 0),
  21. (ushort)((low & 0x0000ffff00000000) >> 32),
  22. (ushort)((low & 0xffff000000000000) >> 48),
  23. (byte)((high & 0x00000000000000ff) >> 0),
  24. (byte)((high & 0x000000000000ff00) >> 8),
  25. (byte)((high & 0x0000000000ff0000) >> 16),
  26. (byte)((high & 0x00000000ff000000) >> 24),
  27. (byte)((high & 0x000000ff00000000) >> 32),
  28. (byte)((high & 0x0000ff0000000000) >> 40),
  29. (byte)((high & 0x00ff000000000000) >> 48),
  30. (byte)((high & 0xff00000000000000) >> 56));
  31. }
  32. }
  33. }