UInt128Utils.cs 467 B

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