linux-stable/lib/math
Uwe Kleine-König 8c86fb68ff mul_u64_u64_div_u64: increase precision by conditionally swapping a and b
As indicated in the added comment, the algorithm works better if b is big.
As multiplication is commutative, a and b can be swapped.  Do this if a
is bigger than b.

Link: https://lkml.kernel.org/r/20240303092408.662449-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-03-12 13:09:22 -07:00
..
cordic.c
div64.c mul_u64_u64_div_u64: increase precision by conditionally swapping a and b 2024-03-12 13:09:22 -07:00
gcd.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
int_log.c lib/math/int_log: Replace LGPL-2.1-or-later boilerplate with SPDX identifier 2023-07-09 22:47:50 +01:00
int_pow.c kernel.h: split out mathematical helpers 2020-12-15 22:46:15 -08:00
int_sqrt.c kernel.h: split out mathematical helpers 2020-12-15 22:46:15 -08:00
Kconfig math: make RATIONAL tristate 2021-09-08 11:50:26 -07:00
lcm.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
Makefile lib/math: Move dvb_math.c into lib/math/int_log.c 2023-07-09 22:47:48 +01:00
prime_numbers.c lib/math: avoid trailing newline hidden in pr_fmt() 2020-06-04 19:06:24 -07:00
rational-test.c lib/math/rational: add Kunit test cases 2021-07-01 11:06:05 -07:00
rational.c math: make RATIONAL tristate 2021-09-08 11:50:26 -07:00
reciprocal_div.c kernel.h: split out mathematical helpers 2020-12-15 22:46:15 -08:00
test_div64.c lib/math/test_div64: Correct the spelling of "dividend" 2021-04-23 13:40:05 +02:00