summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@openbsd.org>2006-06-15 15:44:45 +0000
committerjason <jason@openbsd.org>2006-06-15 15:44:45 +0000
commitc5e20b8b0c23b2186605588cbec8485e6ce1961e (patch)
tree973e97789268e1fb17c890c0ae50f091216c9847
parentoxford 16pci954/siig 2050 has a 10x clock (why?!) (diff)
downloadwireguard-openbsd-c5e20b8b0c23b2186605588cbec8485e6ce1961e.tar.xz
wireguard-openbsd-c5e20b8b0c23b2186605588cbec8485e6ce1961e.zip
make the clock error calculation match dev/ic/com.c so that things with,
say, a 10x clock work.
-rw-r--r--sys/arch/i386/isa/pccom.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/arch/i386/isa/pccom.c b/sys/arch/i386/isa/pccom.c
index cedee9e5fa8..f694dbe77e2 100644
--- a/sys/arch/i386/isa/pccom.c
+++ b/sys/arch/i386/isa/pccom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccom.c,v 1.51 2006/04/27 19:31:43 deraadt Exp $ */
+/* $OpenBSD: pccom.c,v 1.52 2006/06/15 15:44:45 jason Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@@ -204,7 +204,7 @@ comspeed(freq, speed)
x = divrnd((freq / 16), speed);
if (x <= 0)
return -1;
- err = divrnd((freq / 16) * 1000, speed * x) - 1000;
+ err = divrnd((quad_t)freq * 1000 / 16, speed * x) - 1000;
if (err < 0)
err = -err;
if (err > COM_TOLERANCE)