From 6b19a074018743646d4142f41beac38c98c47033 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Sun, 20 Apr 2008 13:22:34 +0300 Subject: ubi-utils: improve input parameters checks Signed-off-by: Artem Bityutskiy --- ubi-utils/new-utils/src/common.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ubi-utils/new-utils/src/common.h') 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); -- cgit v1.2.3