diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-12-06 13:20:29 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-12-06 13:20:29 +0100 |
commit | 082560fd5b48ff4b8c0f6c9b093c86ddf75052f6 (patch) | |
tree | 9fb94182913ec1be8624586b220cf7d5ebed5937 | |
parent | f5d9b2222bc6194f35442894e0ca0ea9bb8e1f23 (diff) | |
download | plan9front-082560fd5b48ff4b8c0f6c9b093c86ddf75052f6.tar.xz |
rio: rewrite better portion() function
-rw-r--r-- | sys/src/cmd/rio/rio.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c index 458d26d34..13c9e29eb 100644 --- a/sys/src/cmd/rio/rio.c +++ b/sys/src/cmd/rio/rio.c @@ -392,16 +392,15 @@ whichrect(Rectangle r, Point p, int which) 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; } |