commit 6868022346288eb52f439d13173d167209bd5a55 parent ccb962b2ea91a7764fac2f3755c9d25b9ccdde66 Author: Kris Maglione <kris@suckless.org> Date: Wed, 21 Jul 2010 10:08:01 -0400 Fix quadrant(). Closes issue #210. Diffstat:
lib/libstuff/geom/quadrant.c | | | 14 | ++++---------- |
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/lib/libstuff/geom/quadrant.c b/lib/libstuff/geom/quadrant.c @@ -8,16 +8,10 @@ quadrant(Rectangle r, Point pt) { Align ret; pt = subpt(pt, r.min); - ret = 0; - - if(pt.x >= Dx(r) * .5) - ret |= East; - if(pt.x <= Dx(r) * .5) - ret |= West; - if(pt.y <= Dy(r) * .5) - ret |= North; - if(pt.y >= Dy(r) * .5) - ret |= South; + ret = East * (pt.x >= Dx(r) * .5) + | West * (pt.x < Dx(r) * .5) + | South * (pt.y >= Dy(r) * .5) + | North * (pt.y < Dy(r) * .5); return ret; }