aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Utilities/IntUtils.cs
blob: 57e9d396f3c66303975a8ac782f7f81714c4a5f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
namespace Ryujinx.HLE.Utilities
{
    static class IntUtils
    {
        public static int AlignUp(int Value, int Size)
        {
            return (Value + (Size - 1)) & ~(Size - 1);
        }

        public static long AlignUp(long Value, int Size)
        {
            return (Value + (Size - 1)) & ~((long)Size - 1);
        }

        public static int AlignDown(int Value, int Size)
        {
            return Value & ~(Size - 1);
        }

        public static long AlignDown(long Value, int Size)
        {
            return Value & ~((long)Size - 1);
        }
    }
}