aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Utilities/IntUtils.cs
blob: a7178d80cb11946bfe8fcb8845b6f9ca1450c7e5 (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);
        }
    }
}