Commit b9a7045b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

OpenGL: use clz()

parent 0af63c4f
...@@ -93,14 +93,11 @@ ...@@ -93,14 +93,11 @@
# define VLCGL_TYPE VLCGL_RGB_TYPE # define VLCGL_TYPE VLCGL_RGB_TYPE
#endif #endif
static inline int GetAlignedSize(int i_size) static inline int GetAlignedSize(unsigned size)
{ {
/* Return the nearest power of 2 */ /* Return the smallest larger or equal power of 2 */
int i_result = 1; unsigned align = 1 << (8 * sizeof (unsigned) - clz(size));
while(i_result < i_size) return ((align >> 1) == size) ? size : align;
i_result *= 2;
return i_result;
} }
int vout_display_opengl_Init(vout_display_opengl_t *vgl, int vout_display_opengl_Init(vout_display_opengl_t *vgl,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment