diff --git a/linux-ramdump-parser-v2/bitops.py b/linux-ramdump-parser-v2/bitops.py
index 4f9da69254b587f587f3a94f642bb65c20a4dc50..ab1901af4e756bb1c1b287836fddf4671c29a947 100644
--- a/linux-ramdump-parser-v2/bitops.py
+++ b/linux-ramdump-parser-v2/bitops.py
@@ -9,6 +9,8 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+import ctypes
+
 
 def bm(msb, lsb):
     'Creates a bitmask from msb to lsb'
@@ -25,3 +27,10 @@ def is_set(val, bit):
     if (val >> bit) & 0x1:
         return True
     return False
+
+
+def align(x, a):
+    """Round x up to the nearest multiple of a"""
+    # See include/uapi/linux/kernel.h
+    notmask = ctypes.c_uint64(~(a - 1)).value
+    return (x + a - 1) & notmask