git: 9front

Download patch

ref: 01ad18668c7ed57c873f03cb624dd7a2744bf474
parent: 7a0a5c753b7524302d659c114b2fd559952b3b20
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Nov 1 07:12:41 EST 2015

libmp: optimize case x/0xffffffff in mpdigdiv() (helps arm)

--- a/sys/src/libmp/port/mpdigdiv.c
+++ b/sys/src/libmp/port/mpdigdiv.c
@@ -21,6 +21,19 @@
 		return;
 	}
 
+	// very common case
+	if(~divisor == 0){
+		lo += hi;
+		if(lo < hi){
+			hi++;
+			lo++;
+		}
+		if(lo+1 == 0)
+			hi++;
+		*quotient = hi;
+		return;
+	}
+
 	// at this point we know that hi < divisor
 	// just shift and subtract till we're done
 	q = 0;
--