From 2450f86bb15763e4c1bcb9e1382350815ca719c2 Mon Sep 17 00:00:00 2001 From: green Date: Tue, 20 Jul 1999 15:37:28 +0000 Subject: Make bcd2int work (resume time reporting now works.) PR: 12613 Submitted by: Michael Constant --- usr.sbin/apm/apm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c index 8ad45ac..e070915 100644 --- a/usr.sbin/apm/apm.c +++ b/usr.sbin/apm/apm.c @@ -15,7 +15,7 @@ #ifndef lint static const char rcsid[] = - "$Id: apm.c,v 1.14 1998/09/04 16:08:54 imp Exp $"; + "$Id: apm.c,v 1.15 1999/07/20 15:31:23 green Exp $"; #endif /* not lint */ #include @@ -72,13 +72,15 @@ int bcd2int(int bcd) { int retval = 0; + int place = 1; if (bcd > 0x9999) return -1; while (bcd) { - retval = retval * 10 + ((bcd & 0xf000) >> 12); - bcd = (bcd & 0xfff) << 4; + retval += (bcd & 0xf) * place; + bcd >>= 4; + place *= 10; } return retval; } -- cgit v1.1