diff --git a/common/include/ogl_init.h b/common/include/ogl_init.h index bb53bbc35..419efdc0f 100644 --- a/common/include/ogl_init.h +++ b/common/include/ogl_init.h @@ -108,7 +108,7 @@ bool g3_draw_tmap_2(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,g3s_lrgb *lig void ogl_draw_vertex_reticle(int cross,int primary,int secondary,int color,int alpha,int size_offs); void ogl_toggle_depth_test(int enable); void ogl_set_blending(); -int pow2ize(int x);//from ogl.c +unsigned pow2ize(unsigned x);//from ogl.c #ifdef __cplusplus } diff --git a/similar/arch/ogl/ogl.c b/similar/arch/ogl/ogl.c index 059cf712c..305788e36 100644 --- a/similar/arch/ogl/ogl.c +++ b/similar/arch/ogl/ogl.c @@ -1254,10 +1254,15 @@ void gr_flip(void) } //little hack to find the nearest bigger power of 2 for a given number -int pow2ize(int x){ - int i; - for (i=2; i 0;) + f1 |= f1 >> (1 << i); + unsigned f2 = f1 + 1; + assert(f2 >= f0); + assert(!(f2 & f1)); + assert((f2 >> 1) < f0); + return f2; } // Allocate the pixel buffers 'pixels' and 'texbuf' based on current screen resolution