UInt128Utils.cs 507 B

123456789101112131415161718
  1. using System;
  2. using System.Globalization;
  3. namespace Ryujinx.Common.Utilities
  4. {
  5. public static class UInt128Utils
  6. {
  7. public static UInt128 FromHex(string hex)
  8. {
  9. return new UInt128(ulong.Parse(hex.AsSpan(0, 16), NumberStyles.HexNumber), ulong.Parse(hex.AsSpan(16), NumberStyles.HexNumber));
  10. }
  11. public static UInt128 CreateRandom()
  12. {
  13. return new UInt128((ulong)Random.Shared.NextInt64(), (ulong)Random.Shared.NextInt64());
  14. }
  15. }
  16. }