From b50602007656962ab6717d63d2f9d83e5c00dacf Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Tue, 6 Feb 2024 22:38:14 -0800 Subject: commonlib: Change GCD function to always use 64 bits It seems that we have some applications where we need to calculate a GCD in 64 bits. Now, we could instantiate the algorithm multiple times for different bit width combinations to be able to use the most efficient one for each problem... but considering that the function usually only gets called once per callsite per stage, and that software emulation of 64-bit division on 32-bit systems doesn't take *that* long either, we would probably usually be paying more time loading the second instance of the function than we save with faster divisions. So let's just make things easy and always do it in 64-bit and then nobody has to spend time thinking on which version to call. Change-Id: I028361444c4048a0d76ba4f80c7334a9d9983c87 Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/c/coreboot/+/80319 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin --- src/soc/rockchip/rk3288/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/soc/rockchip/rk3288') diff --git a/src/soc/rockchip/rk3288/clock.c b/src/soc/rockchip/rk3288/clock.c index d52fa2a858..5b1350a4f6 100644 --- a/src/soc/rockchip/rk3288/clock.c +++ b/src/soc/rockchip/rk3288/clock.c @@ -453,7 +453,7 @@ void rkclk_configure_i2s(unsigned int hz) 1 << 15 | 0 << 12 | 1 << 8 | 0 << 0)); /* set frac divider */ - v = gcd32(GPLL_HZ, hz); + v = gcd(GPLL_HZ, hz); n = (GPLL_HZ / v) & (0xffff); d = (hz / v) & (0xffff); assert(hz == GPLL_HZ / n * d); -- cgit v1.2.3