]> wimlib.net Git - wimlib/blobdiff - include/wimlib/util.h
New helper macro: ALIGN()
[wimlib] / include / wimlib / util.h
index 67044638d825f6bf32fabb41102815be0ab7276f..c3bac7abe46be8d0c55f105989f318860e78dd8a 100644 (file)
 /* Get the number of elements of an array type.  */
 #define ARRAY_LEN(array)       (sizeof(array) / sizeof((array)[0]))
 
+/* Round 'v' up to the next 'alignment'-byte aligned boundary.  'alignment' must
+ * be a power of 2.  */
+#define ALIGN(v, alignment)    (((v) + ((alignment) - 1)) & ~((alignment) - 1))
+
 /* Maximum number of bytes that can be allocated on the stack.
  *
  * Note: this isn't a hard bound on the stack space used, since this is just for
@@ -117,4 +121,14 @@ cmp_u64(u64 n1, u64 n2)
        return 0;
 }
 
+/************************
+ * System information
+ ************************/
+
+unsigned
+get_available_cpus(void);
+
+u64
+get_available_memory(void);
+
 #endif /* _WIMLIB_UTIL_H */