Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / lib / libkern / bcd.c
blobecc8ea94c5dc3cb147759d2725c9bbe40629406a
1 /* $NetBSD$ */
3 /*
4 * Convert a single byte between (unsigned) packed bcd and binary.
5 * Public domain.
6 */
8 #include <sys/cdefs.h>
9 __KERNEL_RCSID(0,"$NetBSD$");
11 #include <lib/libkern/libkern.h>
13 unsigned int
14 bcdtobin(unsigned int bcd)
17 return (((bcd >> 4) & 0x0f) * 10 + (bcd & 0x0f));
20 unsigned int
21 bintobcd(unsigned int bin)
24 return ((((bin / 10) << 4) & 0xf0) | (bin % 10));