diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c index 8ad45ac4dbd4..e070915f0b95 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; }