summaryrefslogtreecommitdiff
path: root/include/bcd.h
AgeCommit message (Collapse)Author
2026-01-02lib/bcd: optimize _bin2bcd() for improved performanceKuan-Wei Chiu
[ 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]>
2015-05-05dm: Remove unnecessary types in bcd.hSimon Glass
We don't need to use u8, and if we avoid it, it isn't so much of a problem that rtc.h includes this header. With this change we can include rtc.h from sandbox files. Signed-off-by: Simon Glass <[email protected]>
2009-08-25Replace BCD2BIN and BIN2BCD macros with inline functionsAlbin Tonnerre
In the process, also remove backward-compatiblity macros BIN_TO_BCD and BCD_TO_BIN and update the sole board using them to use the new bin2bcd and bcd2bin instead Signed-off-by: Albin Tonnerre <[email protected]> Acked-by: Stefan Roese <[email protected]> Acked-by: Detlev Zundel <[email protected]>
2007-10-31rtc: Add Xicor/Intersil X1205 RTC supportStefan Roese
This patch adds support for the Xicor/Intersil X1205 RTC used on the AMCC Makalu eval board. This driver is basically cloned from the Linux driver version (2.6.23). This patch also introduces the Linux bcd.h header for the BCD2BIN/ BIN2BCD conversions. In the future some of the other U-Boot RTC driver should be converted to also use this header instead of implementing their own local copy of these functions/macros. Signed-off-by: Stefan Roese <[email protected]>