X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Frd-bomb.c;h=08ec7a753d9c84dd8c2a6accab19ac5b607c8ecd;hb=d5186197bc394e10a4402f7f6d23fbb14103bc50;hp=dfcc2897cab5cacf51cb1c4c0d2c1cec183b4e31;hpb=dba664f31aa87285db4d76cf8c5e66335299703a;p=xscreensaver diff --git a/hacks/rd-bomb.c b/hacks/rd-bomb.c index dfcc2897..08ec7a75 100644 --- a/hacks/rd-bomb.c +++ b/hacks/rd-bomb.c @@ -95,10 +95,10 @@ pixack_init(struct state *st, int *size_h, int *size_v) st->height = get_integer_resource (st->dpy, "height", "Integer"); if (st->width <= 0 && st->height <= 0 && (R & 1)) - st->width = st->height = 48 + BELLRAND(256); + st->width = st->height = 64 + BELLRAND(512); - if (st->width <= 0) st->width = 48 + BELLRAND(256); - if (st->height <= 0) st->height = 48 + BELLRAND(256); + if (st->width <= 0) st->width = 64 + BELLRAND(512); + if (st->height <= 0) st->height = 64 + BELLRAND(512); if (st->width > st->xgwa.width) st->width = st->xgwa.width; if (st->height > st->xgwa.height) st->height = st->xgwa.height; @@ -236,7 +236,9 @@ pixack_frame(struct state *st, char *pix_buf) /* John E. Pearson "Complex Patterns in a Simple System" Science, July 1993 */ - uvv = (((r1 * r2) >> bps) * r2) >> bps; + /* uvv = (((r1 * r2) >> bps) * r2) >> bps; */ + /* avoid signed integer overflow */ + uvv = ((((r1 >> 1)* r2) >> bps) * r2) >> (bps - 1); switch (st->reaction) { /* costs 4% */ case 0: r1 += 4 * (((28 * (mx-r1)) >> 10) - uvv);