1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-30 09:22:02 +00:00
Ryujinx/Ryujinx.HLE/Utilities/IntUtils.cs

26 lines
596 B
C#
Raw Normal View History

namespace Ryujinx.HLE.Utilities
{
2018-12-01 20:38:15 +00:00
internal static class IntUtils
{
2018-12-01 20:01:59 +00:00
public static int AlignUp(int value, int size)
{
2018-12-01 20:01:59 +00:00
return (value + (size - 1)) & ~(size - 1);
}
2018-12-01 20:01:59 +00:00
public static long AlignUp(long value, int size)
{
2018-12-01 20:01:59 +00:00
return (value + (size - 1)) & ~((long)size - 1);
}
2018-12-01 20:01:59 +00:00
public static int AlignDown(int value, int size)
{
2018-12-01 20:01:59 +00:00
return value & ~(size - 1);
}
2018-12-01 20:01:59 +00:00
public static long AlignDown(long value, int size)
{
2018-12-01 20:01:59 +00:00
return value & ~((long)size - 1);
}
}
}