diff options
Diffstat (limited to 'Ryujinx.HLE/Utilities/IntUtils.cs')
-rw-r--r-- | Ryujinx.HLE/Utilities/IntUtils.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Ryujinx.HLE/Utilities/IntUtils.cs b/Ryujinx.HLE/Utilities/IntUtils.cs new file mode 100644 index 00000000..57e9d396 --- /dev/null +++ b/Ryujinx.HLE/Utilities/IntUtils.cs @@ -0,0 +1,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); + } + } +} |