git: 9front

Download patch

ref: 4e1f5567e27a08083e83029cf3f09a12e9244ff5
parent: 3f2d4c3b48fd2d4df26180b078fabfc8e7c63033
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Dec 6 08:20:29 EST 2020

rio: rewrite better portion() function

--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -392,16 +392,15 @@
 int
 portion(int x, int lo, int hi)
 {
-	int t;
 	x -= lo;
 	hi -= lo;
-	t = min(20, max(1, hi/2));
-	if(hi < t)
-		return x > 0 ? 2 : 0;
-	if(x < t)
-		return 0;
-	if(x > hi-t)
-		return 2;
+	if(x < hi/2){
+		if(x < 20)
+			return 0;
+	} else {
+		if(x > hi-20)
+			return 2;
+	}
 	return 1;
 }
 
--