From 6ca5b0bf3324b36151ed21a4539133b89d1a8d2d Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Mon, 28 Jan 2002 09:09:03 +0000 Subject: [PATCH] replaced a bunch of one-line 3-statement while loops, with nicer looking one-line for loops git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1434 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/gl_textures.c b/gl_textures.c index 78bd26a7..52c0da59 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -372,12 +372,10 @@ static int R_CalcTexelDataSize (gltexture_t *glt) if (r_max_size.integer > realmaxsize) Cvar_SetValue("r_max_size", realmaxsize); // calculate final size - width2 = 1;while (width2 < glt->width) width2 <<= 1; - height2 = 1;while (height2 < glt->height) height2 <<= 1; - width2 >>= (int) r_picmip.integer; - height2 >>= (int) r_picmip.integer; - while (width2 > (int) r_max_size.integer) width2 >>= 1; - while (height2 > (int) r_max_size.integer) height2 >>= 1; + for (width2 = 1;width2 < glt->width;width2 <<= 1); + for (height2 = 1;height2 < glt->height;height2 <<= 1); + for (width2 >>= r_picmip.integer;width2 > r_max_size.integer;width2 >>= 1); + for (height2 >>= r_picmip.integer;height2 > r_max_size.integer;height2 >>= 1); if (width2 < 1) width2 = 1; if (height2 < 1) height2 = 1; @@ -1041,8 +1039,8 @@ static void R_Upload(gltexture_t *glt, byte *data) glt->image->flags &= ~GLTEXF_UPLOAD; // these are rounded up versions of the size to do better resampling - width = 1;while(width < glt->width) width *= 2; - height = 1;while(height < glt->height) height *= 2; + for (width = 1;width < glt->width;width <<= 1); + for (height = 1;height < glt->height;height <<= 1); if (resizebuffersize < width * height * glt->image->bytesperpixel) { @@ -1205,10 +1203,10 @@ static void R_FindImageForTexture(gltexture_t *glt) // calculate final size if (r_max_size.integer > realmaxsize) Cvar_SetValue("r_max_size", realmaxsize); - image->width = 1;while (image->width < glt->width) image->width <<= 1; - image->height = 1;while (image->height < glt->height) image->height <<= 1; - image->width >>= r_picmip.integer;while (image->width > r_max_size.integer) image->width >>= 1; - image->height >>= r_picmip.integer;while (image->height > r_max_size.integer) image->height >>= 1; + for (image->width = 1;image->width < glt->width;image->width <<= 1); + for (image->height = 1;image->height < glt->height;image->height <<= 1); + for (image->width >>= r_picmip.integer;image->width > r_max_size.integer;image->width >>= 1); + for (image->height >>= r_picmip.integer;image->height > r_max_size.integer;image->height >>= 1); if (image->width < 1) image->width = 1; if (image->height < 1) image->height = 1; } -- 2.39.2