blob: 40d304efe27281151124a874cdbac864f997a7ee [file] [log] [blame]
David Brownelld3de8512008-07-23 21:30:37 -07001#include <linux/bcd.h>
Paul Gortmaker8bc3bcc2011-11-16 21:29:17 -05002#include <linux/export.h>
David Brownelld3de8512008-07-23 21:30:37 -07003
Sebastian Andrzej Siewiorb53d6572012-09-07 14:31:45 +02004unsigned _bcd2bin(unsigned char val)
David Brownelld3de8512008-07-23 21:30:37 -07005{
6 return (val & 0x0f) + (val >> 4) * 10;
7}
Sebastian Andrzej Siewiorb53d6572012-09-07 14:31:45 +02008EXPORT_SYMBOL(_bcd2bin);
David Brownelld3de8512008-07-23 21:30:37 -07009
Sebastian Andrzej Siewiorb53d6572012-09-07 14:31:45 +020010unsigned char _bin2bcd(unsigned val)
David Brownelld3de8512008-07-23 21:30:37 -070011{
12 return ((val / 10) << 4) + val % 10;
13}
Sebastian Andrzej Siewiorb53d6572012-09-07 14:31:45 +020014EXPORT_SYMBOL(_bin2bcd);