summaryrefslogtreecommitdiff
path: root/NW4RTools/Misc.cs
diff options
context:
space:
mode:
Diffstat (limited to 'NW4RTools/Misc.cs')
-rw-r--r--NW4RTools/Misc.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/NW4RTools/Misc.cs b/NW4RTools/Misc.cs
new file mode 100644
index 0000000..c42b185
--- /dev/null
+++ b/NW4RTools/Misc.cs
@@ -0,0 +1,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);
+ }
+ }
+}
+