projects
/
project
/
firmware-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0725c3d
)
ptgen: fix misprint and simplify calculation a bit
author
Mikhail Kshevetskiy
<
[email protected]
>
Fri, 10 Jan 2025 08:23:54 +0000
(11:23 +0300)
committer
Daniel Golle
<
[email protected]
>
Tue, 23 Sep 2025 22:15:33 +0000
(23:15 +0100)
2 << ((10 * exp) - 1) is equal to 1 << (10 * exp). This allows us
simplify a formula and remove extra if.
Signed-off-by: Mikhail Kshevetskiy <
[email protected]
>
src/ptgen.c
patch
|
blob
|
history
diff --git
a/src/ptgen.c
b/src/ptgen.c
index c7d6bc0ae4e1853b6af568292c53313d90700007..e5fee0debb46863c9ac18e6947be91c7f32e0528 100644
(file)
--- a/
src/ptgen.c
+++ b/
src/ptgen.c
@@
-203,10
+203,8
@@
static long to_kbytes(const char *string)
return 0;
}
- /* result: number + 1024^(exp) */
- if (exp == 0)
- return result;
- return result * (2 << ((10 * exp) - 1));
+ /* result: number * 1024^(exp) */
+ return result * (1 << (10 * exp));
}
/* convert the sector number into a CHS value for the partition table */