diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-04-20 13:22:34 +0300 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-04-20 18:16:06 +0300 |
commit | 6b19a074018743646d4142f41beac38c98c47033 (patch) | |
tree | 8b3415175982a89a3d0d11052d23a8c76cfb66d6 /ubi-utils/new-utils/src/common.h | |
parent | 66b4b7c89ae3cbaffbb075ab9eacb6434cf0c8ed (diff) |
ubi-utils: improve input parameters checks
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/new-utils/src/common.h')
-rw-r--r-- | ubi-utils/new-utils/src/common.h | 5 |
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); |