summaryrefslogtreecommitdiff
path: root/disk
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-01-16 20:36:58 +0100
committerTom Rini <trini@konsulko.com>2020-01-23 07:29:58 -0500
commita9d1c0e2bc3fced595b742d90e65c744c55616b3 (patch)
tree3d5adbb8b209dc38b11c0b12ff47e0ec37633a7d /disk
parentc7c0233235542db090bbe0b75ee6ae0dbcc43bac (diff)
disk: part: rename parameter of lba512_muldiv()
div_by is a misleading parameter name, when we are doing >> div_by. Rename it to right_shift. Reported-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'disk')
-rw-r--r--disk/part.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/disk/part.c b/disk/part.c
index 8982ef3bae..4cc2fc19f7 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -104,17 +104,18 @@ typedef lbaint_t lba512_t;
#endif
/*
- * Overflowless variant of (block_count * mul_by / 2**div_by)
- * when div_by > mul_by
+ * Overflowless variant of (block_count * mul_by / 2**right_shift)
+ * when 2**right_shift > mul_by
*/
-static lba512_t lba512_muldiv(lba512_t block_count, lba512_t mul_by, int div_by)
+static lba512_t lba512_muldiv(lba512_t block_count, lba512_t mul_by,
+ int right_shift)
{
lba512_t bc_quot, bc_rem;
/* x * m / d == x / d * m + (x % d) * m / d */
- bc_quot = block_count >> div_by;
- bc_rem = block_count - (bc_quot << div_by);
- return bc_quot * mul_by + ((bc_rem * mul_by) >> div_by);
+ bc_quot = block_count >> right_shift;
+ bc_rem = block_count - (bc_quot << right_shift);
+ return bc_quot * mul_by + ((bc_rem * mul_by) >> right_shift);
}
void dev_print (struct blk_desc *dev_desc)