Blame view

lib/bcd.c 297 Bytes
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  // SPDX-License-Identifier: GPL-2.0
d3de851a4   David Brownell   rtc: BCD codeshrink
2
  #include <linux/bcd.h>
8bc3bcc93   Paul Gortmaker   lib: reduce the u...
3
  #include <linux/export.h>
d3de851a4   David Brownell   rtc: BCD codeshrink
4

b53d657d8   Sebastian Andrzej Siewior   usb/core: use bin...
5
  unsigned _bcd2bin(unsigned char val)
d3de851a4   David Brownell   rtc: BCD codeshrink
6
7
8
  {
  	return (val & 0x0f) + (val >> 4) * 10;
  }
b53d657d8   Sebastian Andrzej Siewior   usb/core: use bin...
9
  EXPORT_SYMBOL(_bcd2bin);
d3de851a4   David Brownell   rtc: BCD codeshrink
10

b53d657d8   Sebastian Andrzej Siewior   usb/core: use bin...
11
  unsigned char _bin2bcd(unsigned val)
d3de851a4   David Brownell   rtc: BCD codeshrink
12
13
14
  {
  	return ((val / 10) << 4) + val % 10;
  }
b53d657d8   Sebastian Andrzej Siewior   usb/core: use bin...
15
  EXPORT_SYMBOL(_bin2bcd);