IntUtils.cs 587 B

12345678910111213141516171819202122232425
  1. namespace Ryujinx.HLE.Utilities
  2. {
  3. static class IntUtils
  4. {
  5. public static int AlignUp(int Value, int Size)
  6. {
  7. return (Value + (Size - 1)) & ~(Size - 1);
  8. }
  9. public static long AlignUp(long Value, int Size)
  10. {
  11. return (Value + (Size - 1)) & ~((long)Size - 1);
  12. }
  13. public static int AlignDown(int Value, int Size)
  14. {
  15. return Value & ~(Size - 1);
  16. }
  17. public static long AlignDown(long Value, int Size)
  18. {
  19. return Value & ~((long)Size - 1);
  20. }
  21. }
  22. }