Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105482
b: refs/heads/master
c: d3de851
h: refs/heads/master
v: v3
  • Loading branch information
David Brownell authored and Linus Torvalds committed Jul 24, 2008
1 parent 1169ed8 commit 8d3e187
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 53e84b672c1a8190af2b376c35c7a39cf1214f59
refs/heads/master: d3de851a445123f24ad8ece18662014b5e8a8b4e
9 changes: 7 additions & 2 deletions trunk/include/linux/bcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
#ifndef _BCD_H
#define _BCD_H

#define BCD2BIN(val) (((val) & 0x0f) + ((val)>>4)*10)
#define BIN2BCD(val) ((((val)/10)<<4) + (val)%10)
#include <linux/compiler.h>

unsigned bcd2bin(unsigned char val) __attribute_const__;
unsigned char bin2bcd(unsigned val) __attribute_const__;

#define BCD2BIN(val) bcd2bin(val)
#define BIN2BCD(val) bin2bcd(val)

/* backwards compat */
#define BCD_TO_BIN(val) ((val)=BCD2BIN(val))
Expand Down
2 changes: 1 addition & 1 deletion trunk/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ lib-$(CONFIG_SMP) += cpumask.o

lib-y += kobject.o kref.o klist.o

obj-y += div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o

ifeq ($(CONFIG_DEBUG_KOBJECT),y)
Expand Down
14 changes: 14 additions & 0 deletions trunk/lib/bcd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <linux/bcd.h>
#include <linux/module.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);

0 comments on commit 8d3e187

Please sign in to comment.