Revision 3f4092766eaf692ed79b69f59c98dbe38e557fe7 authored by Dom Cobley on 19 December 2022, 18:36:18 UTC, committed by Dom Cobley on 19 December 2022, 18:36:18 UTC
2 parent s e5c6e2c + d68f50b
Raw File
bcd.c
// SPDX-License-Identifier: GPL-2.0
#include <linux/bcd.h>
#include <linux/export.h>

unsigned _bcd2bin(unsigned char val)
{
	return (val & 0x0f) + (val >> 4) * 10;
}
EXPORT_SYMBOL(_bcd2bin);

unsigned char _bin2bcd(unsigned val)
{
	return ((val / 10) << 4) + val % 10;
}
EXPORT_SYMBOL(_bin2bcd);
back to top