shithub: riscv

Download patch

ref: 5b66b52623748f00ff1e48013b8136391454af57
parent: c0a9c3b551ed5d9b3a9d8389e36a3eb059662702
author: cinap_lenrek <[email protected]>
date: Sun Sep 11 19:19:18 EDT 2016

libc: dont use floating point for portable umuldiv(), use 64 bit uvlong

--- a/sys/src/libc/port/muldiv.c
+++ b/sys/src/libc/port/muldiv.c
@@ -4,12 +4,7 @@
 ulong
 umuldiv(ulong a, ulong b, ulong c)
 {
-	double d;
-
-	d = ((double)a * (double)b) / (double)c;
-	if(d >= 4294967296.)
-		abort();
-	return d;
+	return ((uvlong)a * (uvlong)b) / c;
 }
 
 long