USB: adutux: fix use-after-free on disconnect
[linux/fpc-iii.git] / lib / bcd.c
blob7e4750b6e801425dd1c3a68402607b189ca6b99d
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/bcd.h>
3 #include <linux/export.h>
5 unsigned _bcd2bin(unsigned char val)
7 return (val & 0x0f) + (val >> 4) * 10;
9 EXPORT_SYMBOL(_bcd2bin);
11 unsigned char _bin2bcd(unsigned val)
13 return ((val / 10) << 4) + val % 10;
15 EXPORT_SYMBOL(_bin2bcd);