From 38886de0c3e9ea5729ef23e4c653fa2822f52e8f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 6 Apr 2021 14:43:39 +0200 Subject: xscreensaver 6.00 --- hacks/munch.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'hacks/munch.c') 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 +#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) { -- cgit v1.2.3-55-g7522