On Sat, 2012-11-03 at 18:38 +0000, Xin LI wrote: > Author: delphij > Date: Sat Nov 3 18:38:28 2012 > New Revision: 242519 > URL: http://svn.freebsd.org/changeset/base/242519 > > Log: > Replace log(3) with flsll(3) for watchdogd(8) and drop libm dependency. > > MFC after: 2 weeks > > Modified: > head/usr.sbin/watchdogd/Makefile > head/usr.sbin/watchdogd/watchdogd.c > > Modified: head/usr.sbin/watchdogd/Makefile > ============================================================================== > --- head/usr.sbin/watchdogd/Makefile Sat Nov 3 18:21:32 2012 > (r242518) > +++ head/usr.sbin/watchdogd/Makefile Sat Nov 3 18:38:28 2012 > (r242519) > @@ -4,8 +4,8 @@ PROG= watchdogd > LINKS= ${BINDIR}/watchdogd ${BINDIR}/watchdog > MAN= watchdogd.8 watchdog.8 > > -LDADD= -lm -lutil > -DPADD= ${LIBM} ${LIBUTIL} > +LDADD= -lutil > +DPADD= ${LIBUTIL} > > .include <bsd.prog.mk> > > > Modified: head/usr.sbin/watchdogd/watchdogd.c > ============================================================================== > --- head/usr.sbin/watchdogd/watchdogd.c Sat Nov 3 18:21:32 2012 > (r242518) > +++ head/usr.sbin/watchdogd/watchdogd.c Sat Nov 3 18:38:28 2012 > (r242519) > @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > +#include <strings.h> > #include <sysexits.h> > #include <unistd.h> > > @@ -280,7 +281,7 @@ parseargs(int argc, char *argv[]) > if (a == 0) > timeout = WD_TO_NEVER; > else > - timeout = 1.0 + log(a * 1e9) / log(2.0); > + timeout = flsll(a * 1e9); > if (debugging) > printf("Timeout is 2^%d nanoseconds\n", > timeout);
Shouldn't we also change the type of the variable 'a' from double to int64 (and the strtod() and the 1e9 constant), thus removing all dregs of floating point where it isn't really needed? (Sorry, but 20 years of working on wimpy embedded systems without FP hardware just make me blurt out these things automatically). -- Ian _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"