summaryrefslogtreecommitdiff
path: root/ubi-utils/new-utils/src/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'ubi-utils/new-utils/src/common.h')
-rw-r--r--ubi-utils/new-utils/src/common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ubi-utils/new-utils/src/common.h b/ubi-utils/new-utils/src/common.h
index 720dec1..fdc69db 100644
--- a/ubi-utils/new-utils/src/common.h
+++ b/ubi-utils/new-utils/src/common.h
@@ -68,6 +68,11 @@ extern "C" {
fprintf(stderr, PROGRAM_NAME ": warning!: " fmt "\n", ##__VA_ARGS__); \
} while(0)
+static inline int is_power_of_2(unsigned long long n)
+{
+ return (n != 0 && ((n & (n - 1)) == 0));
+}
+
long long ubiutils_get_bytes(const char *str);
void ubiutils_print_bytes(long long bytes, int bracket);
void ubiutils_print_text(FILE *stream, const char *txt, int len);