David Brownell | d3de851 | 2008-07-23 21:30:37 -0700 | [diff] [blame] | 1 | #include <linux/bcd.h> |
Paul Gortmaker | 8bc3bcc | 2011-11-16 21:29:17 -0500 | [diff] [blame] | 2 | #include <linux/export.h> |
David Brownell | d3de851 | 2008-07-23 21:30:37 -0700 | [diff] [blame] | 3 | |
Sebastian Andrzej Siewior | b53d657 | 2012-09-07 14:31:45 +0200 | [diff] [blame] | 4 | unsigned _bcd2bin(unsigned char val) |
David Brownell | d3de851 | 2008-07-23 21:30:37 -0700 | [diff] [blame] | 5 | { |
| 6 | return (val & 0x0f) + (val >> 4) * 10; |
| 7 | } |
Sebastian Andrzej Siewior | b53d657 | 2012-09-07 14:31:45 +0200 | [diff] [blame] | 8 | EXPORT_SYMBOL(_bcd2bin); |
David Brownell | d3de851 | 2008-07-23 21:30:37 -0700 | [diff] [blame] | 9 | |
Sebastian Andrzej Siewior | b53d657 | 2012-09-07 14:31:45 +0200 | [diff] [blame] | 10 | unsigned char _bin2bcd(unsigned val) |
David Brownell | d3de851 | 2008-07-23 21:30:37 -0700 | [diff] [blame] | 11 | { |
| 12 | return ((val / 10) << 4) + val % 10; |
| 13 | } |
Sebastian Andrzej Siewior | b53d657 | 2012-09-07 14:31:45 +0200 | [diff] [blame] | 14 | EXPORT_SYMBOL(_bin2bcd); |