summaryrefslogtreecommitdiff
path: root/NW4RTools/Misc.cs
blob: c42b185a066b1485ab58118a312bd39214a182e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
namespace NW4RTools {
	public static class Misc {
		public static int AlignUp(int val, int to) {
			return (val + (to - 1)) & ~(to - 1);
		}

		public static uint AlignUp(uint val, uint to) {
			return (val + (to - 1)) & ~(to - 1);
		}

		public static int AlignDown(int val, int to) {
			return val & ~(to - 1);
		}

		public static uint AlignDown(uint val, uint to) {
			return val & ~(to - 1);
		}
	}
}