summaryrefslogtreecommitdiff
path: root/scripts/basic
diff options
context:
space:
mode:
authorKuan-Wei Chiu <[email protected]>2025-12-11 18:31:30 +0000
committerTom Rini <[email protected]>2026-01-02 15:51:54 -0600
commit9ac621e671858bf0b80dd26b883f3781cc5acb34 (patch)
treeb1deaa721a2fbcb58547e7a18ec7ef3ebf0eb5d4 /scripts/basic
parentf2f69886ac181e74fa378cf49bdee33e6e9a4188 (diff)
lib/bcd: optimize _bin2bcd() for improved performance
[ Upstream commit cbf164cd44e06c78938b4a4a4479d3541779c319 ] The original _bin2bcd() function used / 10 and % 10 operations for conversion. Although GCC optimizes these operations and does not generate division or modulus instructions, the new implementation reduces the number of mov instructions in the generated code for both x86-64 and ARM architectures. This optimization calculates the tens digit using (val * 103) >> 10, which is accurate for values of 'val' in the range [0, 178]. Given that the valid input range is [0, 99], this method ensures correctness while simplifying the generated code. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Kuan-Wei Chiu <[email protected]> Cc: Ching-Chun Huang (Jim) <[email protected]> Signed-off-by: Andrew Morton <[email protected]> [[email protected]: Adapt to bin2bcd() in include/bcd.h] Signed-off-by: Kuan-Wei Chiu <[email protected]>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions