# HG changeset patch # User reimar # Date 1239998210 0 # Node ID 6abd94fdd827439c36d8428bbe57ff8799c1abd2 # Parent cb387dff812d70ce776d05f40c8c762c01ba95dc Use / and % operators instead of reimplementing them with a loop. diff -r cb387dff812d -r 6abd94fdd827 xan.c --- a/xan.c Fri Apr 17 19:49:55 2009 +0000 +++ b/xan.c Fri Apr 17 19:56:50 2009 +0000 @@ -351,16 +351,8 @@ /* coordinate accounting */ total_pixels -= size; - while (size) { - if (x + size >= width) { - y++; - size -= (width - x); - x = 0; - } else { - x += size; - size = 0; - } - } + y += (x + size) / width; + x = (x + size) % width; } }