firmware-utils: add E2100L support to addpattern.c
[lede.git] / tools / firmware-utils / src / ptgen.c
index 2b7ec25e4898abbc1508d8c2e20cfafae4a528c6..8466d35bcc3f5364c318594b092ead2aae9e95b9 100644 (file)
@@ -1,6 +1,6 @@
 /* 
  * ptgen - partition table generator
- * Copyright (C) 2006 by Felix Fietkau <nbd@openwrt.org>
+ * Copyright (C) 2006 by Felix Fietkau <nbd@nbd.name>
  *
  * uses parts of afdisk
  * Copyright (C) 2002 by David Roetzel <david@roetzel.de>
@@ -93,7 +93,9 @@ static long to_kbytes(const char *string) {
        }
 
        /* result: number + 1024^(exp) */
-       return result * ((2 << ((10 * exp) - 1)) ?: 1);
+       if (exp == 0)
+               return result;
+       return result * (2 << ((10 * exp) - 1));
 }
 
 /* convert the sector number into a CHS value for the partition table */