diff options
author | Simon Rettberg | 2021-04-06 14:23:46 +0200 |
---|---|---|
committer | Simon Rettberg | 2021-04-06 14:23:46 +0200 |
commit | 26b6e4255d4b9ff79a6dca10de5bec7bfc8691f9 (patch) | |
tree | a51e1637554bcd84e63cccb1cb220c898a2c4ee8 /hacks/munch.c | |
parent | 5.44 (diff) | |
download | xscreensaver-26b6e4255d4b9ff79a6dca10de5bec7bfc8691f9.tar.gz xscreensaver-26b6e4255d4b9ff79a6dca10de5bec7bfc8691f9.tar.xz xscreensaver-26b6e4255d4b9ff79a6dca10de5bec7bfc8691f9.zip |
xscreensaver 6.00
Diffstat (limited to 'hacks/munch.c')
-rw-r--r-- | hacks/munch.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/hacks/munch.c b/hacks/munch.c index c45e37f..f24629f 100644 --- a/hacks/munch.c +++ b/hacks/munch.c @@ -64,6 +64,7 @@ */ #include <math.h> +#include "pow2.h" #include "screenhack.h" typedef struct _muncher { @@ -97,20 +98,6 @@ struct state { }; -/* - * dumb way to get # of digits in number. Probably faster than actually - * doing a log and a division, maybe. - */ -static int dumb_log_2(int k) -{ - int r = -1; - while (k > 0) { - k >>= 1; r++; - } - return r; -} - - static void calc_logwidths (struct state *st) { /* Choose a range of square sizes based on the window size. We want @@ -121,9 +108,9 @@ static void calc_logwidths (struct state *st) if (st->window_height < st->window_width && st->window_width < st->window_height * 5) { - st->logmaxwidth = (int)dumb_log_2(st->window_height * 0.8); + st->logmaxwidth = (int)i_log2(st->window_height * 0.8); } else { - st->logmaxwidth = (int)dumb_log_2(st->window_width * 0.8); + st->logmaxwidth = (int)i_log2(st->window_width * 0.8); } if (st->logmaxwidth < 2) { |