All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] disk: part: rename parameter of lba512_muldiv()
@ 2020-01-16 19:36 Heinrich Schuchardt
  2020-01-23 22:01 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2020-01-16 19:36 UTC (permalink / raw)
  To: u-boot

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>
---
 disk/part.c | 13 +++++++------
 1 file 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)
--
2.24.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] disk: part: rename parameter of lba512_muldiv()
  2020-01-16 19:36 [PATCH] disk: part: rename parameter of lba512_muldiv() Heinrich Schuchardt
@ 2020-01-23 22:01 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2020-01-23 22:01 UTC (permalink / raw)
  To: u-boot

On Thu, Jan 16, 2020 at 08:36:58PM +0100, Heinrich Schuchardt wrote:

> 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>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200123/1f3f2192/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-23 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 19:36 [PATCH] disk: part: rename parameter of lba512_muldiv() Heinrich Schuchardt
2020-01-23 22:01 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.