aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Common/Utilities/UInt128Utils.cs
blob: 8cc437d17fce4ca8ae5fe4d0a01a10d968edaaac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System;

namespace Ryujinx.Common.Utilities
{
    public static class UInt128Utils
    {
        public static UInt128 FromHex(string hex)
        {
            return new UInt128((ulong)Convert.ToInt64(hex.Substring(0, 16), 16), (ulong)Convert.ToInt64(hex.Substring(16), 16));
        }

        public static UInt128 CreateRandom()
        {
            return new UInt128((ulong)Random.Shared.NextInt64(), (ulong)Random.Shared.NextInt64());
        }
    }
}